util-ex
Version:
Browser-friendly enhanced util fully compatible with standard node.js
9 lines (8 loc) • 321 B
JavaScript
/**
* Checks whether an object is async iterable.
* @param {any} obj The object to be checked.
* @returns {obj is AsyncIterable<any>} Returns true if the object is async iterable; otherwise, returns false.
*/
export function isAsyncIterable(obj) {
return !!obj && typeof obj[Symbol.asyncIterator] === 'function';
}