We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1238557 commit d5df280Copy full SHA for d5df280
src/some_strict.js
@@ -1,14 +1,16 @@
1
-export default async function asyncSomeStrict(arr, fn) {
2
- for (let idx = 0; idx < arr.length; idx += 1) {
3
- const cur = arr[idx];
+import asyncForEachStrict from './forEach_strict';
4
5
- // eslint-disable-next-line no-await-in-loop
6
- const result = await fn(cur, idx, arr);
+export default function asyncSomeStrict(arr, fn) {
+ return new Promise((resolve) => {
+ // eslint-disable-next-line no-shadow
+ asyncForEachStrict(arr, async (cur, idx, arr) => {
7
+ const result = await fn(cur, idx, arr);
8
- if (result) {
9
- return true;
10
- }
11
12
-
13
- return false;
+ if (result) {
+ resolve(true);
+ }
+ }).then(() => {
+ resolve(false);
14
+ });
15
16
}
0 commit comments