isIteratorLike
Test if a value looks like an iterator.
isIteratorLike(obj)
Return true
if obj
has a key "next"
pointing to a zero-argument function; false
otherwise
canReflect.isIteratorLike([][Symbol.iterator]()); // -> true
canReflect.isIteratorLike(new DefineList()[canSymbol.iterator]()); // -> true
canReflect.isIteratorLike(new DefineMap()[canSymbol.iterator]()); // -> true
canReflect.isIteratorLike(null); // -> false
canReflect.isIteratorLike({ next: function() {} }); // -> true
canReflect.isIteratorLike({ next: function(foo) {} }); // -> false (iterator nexts do not take arguments)
Parameters
- obj
{Object}
:the object to test for Iterator traits
Returns
{Boolean}
: