@codibre/fluent-iterable
Version:
Provides LINQ-like fluent api operations for iterables and async iterables (ES2018+).
14 lines (13 loc) • 568 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.isAnyIterable = isAnyIterable;
/**
* Return true when the informed value is any kind of iterable, and false otherwise
* @param value the value to be analyzed
* @returns The return is also a type guard, ie, inside an if with that function, the value will be considered an iterable | async iterable
*/
function isAnyIterable(value) {
return !!(value &&
(typeof value[Symbol.iterator] === 'function' ||
typeof value[Symbol.asyncIterator] === 'function'));
}