UNPKG

417 BJavaScriptView Raw
1import { comparer } from '../util/comparer';
2export async function includes(source, searchElement, fromIndex = 0) {
3 let fromIdx = fromIndex;
4 let i = 0;
5 if (Math.abs(fromIdx)) {
6 fromIdx = 0;
7 }
8 for await (const item of source) {
9 if (i++ > fromIdx && comparer(item, searchElement)) {
10 return true;
11 }
12 }
13 return false;
14}
15
16//# sourceMappingURL=includes.mjs.map