UNPKG

239 BJavaScriptView Raw
1export function first(source, predicate = () => true) {
2 let i = 0;
3 for (let item of source) {
4 if (predicate(item, i++)) {
5 return item;
6 }
7 }
8 return undefined;
9}
10
11//# sourceMappingURL=first.mjs.map