Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/wojtekmaj/async-array-utils. A collection of array-related async utilities.
array array-methods async promise utils
Something went wrong. Try again.
418 B · 16 lines
JavaScript
1234567891011121314151617import asyncForEach from './forEach';
export default function asyncSome(arr, fn) { return new Promise((resolve) => { // eslint-disable-next-line no-shadow asyncForEach(arr, (cur, idx, arr) => new Promise((resolve2) => { fn(cur, idx, arr).then((result) => { if (!result) { resolve(false); } resolve2(); }); })) .then(() => { resolve(true); }); });}