From 81c0dc65aad17c4a9dca21febe36a0f252fa90ee Mon Sep 17 00:00:00 2001 From: Wojciech Maj Date: Thu, 19 Nov 2020 08:35:01 +0100 Subject: [PATCH] Improve asyncSomeStrict example to include side effect --- README.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index af1272a..e476c9d 100644 --- a/README.md +++ b/README.md @@ -146,7 +146,15 @@ Like `asyncSome()`, but runs iterations non-concurrently. ```js import { asyncSomeStrict } from '@wojtekmaj/async-array-utils'; -const largerThanZero = await asyncSomeStrict([1, 2, 3], async (el, index) => el > 0); // true +const indexes = []; +const largerThanZero = await asyncSomeStrict( + [1, 2, 3], + async (el, index) => { + indexes.push(index); + return el > 0; + }, +); // true +console.log(indexes); // [0, 1, 2] ``` ## License -- 2.51.2