@stdlib/assert
Version:
Standard assertion utilities.
39 lines (28 loc) • 937 B
Plain Text
{{alias}}( value )
Tests if a value is iterable-like.
In order to be iterable, an object must implement the @ method,
which, when called, returns an iterator protocol-compliant object.
An iterator protocol-compliant object is an object having a `next` method
which adheres to the iterator protocol.
As full iterator compliance is impossible to achieve without evaluating an
iterator, this function checks *only* for interface compliance.
In environments lacking Symbol.iterator support, this function always
returns `false`.
Parameters
----------
value: any
Value to test.
Returns
-------
bool: boolean
Boolean indicating whether value is iterable-like.
Examples
--------
> var bool = {{alias}}( [ 1, 2, 3 ] )
<boolean>
> bool = {{alias}}( {} )
false
> bool = {{alias}}( null )
false
See Also
--------