util-ex
Version:
Browser-friendly enhanced util fully compatible with standard node.js
9 lines (8 loc) • 304 B
JavaScript
/**
* Determines whether the given object is iterable.
* @param {any} obj - The object to check.
* @returns {obj is Iterable<any>} - Returns true if the object is iterable; otherwise, returns false.
*/
export function isIterable(obj) {
return !!obj && typeof obj[Symbol.iterator] === 'function';
}