@lou.codes/predicates
Version:
🧐 Predicate util functions
17 lines (16 loc) • 527 B
JavaScript
import { asyncIterator } from "@lou.codes/constants/Symbol.js";
import { has } from "./has.js";
/**
* Check if given object has the `Symbol.asyncIterator` symbol.
*
* @category Iterables
* @category Objects
* @example
* ```typescript
* hasAsyncIteratorSymbol({ [Symbol.asyncIterator]() {} }); // true
* hasAsyncIteratorSymbol({ bar: "bar" }); // false
* ```
* @returns `true` when given object has the `Symbol.asyncIterator` symbol,
* `false` otherwise.
*/
export const hasAsyncIteratorSymbol = has(asyncIterator);