iter-tools-es
Version:
The iterable toolbox
30 lines (23 loc) • 729 B
JavaScript
const {
asyncIterableCurry
} = require('../../internal/async-iterable.js');
const {
__asyncFirstOr
} = require('../$first-or/async-first-or.js');
const {
__includes
} = require('../$includes/includes.js');
const none = Symbol('none');
async function __asyncStartsWithAny(iterable, values, same = Object.is) {
const first = await __asyncFirstOr(iterable, none);
if (first === none) return false;
return __includes(values, first, (a, b) => same(b, a));
}
exports.__asyncStartsWithAny = __asyncStartsWithAny;
const asyncStartsWithAny = /*#__PURE__*/asyncIterableCurry(__asyncStartsWithAny, {
minArgs: 1,
maxArgs: 2,
reduces: true,
validateArgs(args) {}
});
exports.asyncStartsWithAny = asyncStartsWithAny;