3.0.0 • Published 5 years ago
is-empty-iterable v3.0.0
is-empty-iterable
Check if an
Iterableis empty
More efficient than Array.from(iterable).length, as it only iterates the first item, which can make a big difference for dynamic iterators, like a Generator doing an expensive operation.
Install
$ npm install is-empty-iterableUsage
import isEmptyIterable from 'is-empty-iterable';
isEmptyIterable([]);
//=> true
isEmptyIterable(new Set([1, 2]));
//=> falseAPI
isEmptyIterable(iterable)
Returns a boolean.
iterable
Type: Iterable