You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency:
Copy file name to clipboardExpand all lines: README.md
+49-31Lines changed: 49 additions & 31 deletions
Original file line number
Diff line number
Diff line change
@@ -18,6 +18,17 @@ limitations under the License.
18
18
19
19
-->
20
20
21
+
22
+
<details>
23
+
<summary>
24
+
About stdlib...
25
+
</summary>
26
+
<p>We believe in a future in which the web is a preferred environment for numerical computation. To help realize this future, we've built stdlib. stdlib is a standard library, with an emphasis on numerical and scientific computation, written in JavaScript (and C) for execution in browsers and in Node.js.</p>
27
+
<p>The library is fully decomposable, being architected in such a way that you can swap out and mix and match APIs and functionality to cater to your exact preferences and use cases.</p>
28
+
<p>When you use stdlib, you can be absolutely certain that you are using the most thorough, rigorous, well-written, studied, documented, tested, measured, and high-quality code out there.</p>
29
+
<p>To join us in bringing numerical computing to the web, get started by checking us out on <ahref="https://github.com/stdlib-js/stdlib">GitHub</a>, and please consider <ahref="https://opencollective.com/stdlib">financially supporting stdlib</a>. We greatly appreciate your continued support!</p>
@@ -69,6 +80,12 @@ function predicate( value, next ) {
69
80
setTimeout( onTimeout, value );
70
81
functiononTimeout() {
71
82
console.log( value );
83
+
/* =>
84
+
1000
85
+
2500
86
+
3000
87
+
*/
88
+
72
89
next( null, false );
73
90
}
74
91
}
@@ -78,17 +95,12 @@ function done( error, bool ) {
78
95
throw error;
79
96
}
80
97
console.log( bool );
98
+
// => true
81
99
}
82
100
83
101
var arr = [ 3000, 2500, 1000 ];
84
102
85
103
noneByAsync( arr, predicate, done );
86
-
/* =>
87
-
1000
88
-
2500
89
-
3000
90
-
true
91
-
*/
92
104
```
93
105
94
106
If a `predicate` function calls the `next` callback with a truthy test argument, the function stops processing any additional `collection` elements and returns `false` for the test result.
@@ -109,19 +121,19 @@ function done( error, bool ) {
109
121
throw error;
110
122
}
111
123
console.log( bool );
124
+
// => false
112
125
}
113
126
114
127
var arr = [ 3000, 2500, 1000 ];
115
128
116
129
noneByAsync( arr, predicate, done );
117
-
// => false
118
130
```
119
131
120
132
The function accepts the following `options`:
121
133
122
134
-`limit`: the maximum number of pending invocations at any one time. Default: `infinity`.
123
135
-`series`: `boolean` indicating whether to sequentially invoke the `predicate` function for each `collection` element. If `true`, the function sets `options.limit=1`. Default: `false`.
124
-
-`thisArg`: the execution context for `fcn`.
136
+
-`thisArg`: the execution context for `predicate`.
125
137
126
138
By default, all elements are processed concurrently, which means that the function does **not** guarantee completion order. To process each `collection` element sequentially, set the `series` option to `true`.
127
139
@@ -130,6 +142,12 @@ function predicate( value, next ) {
130
142
setTimeout( onTimeout, value );
131
143
functiononTimeout() {
132
144
console.log( value );
145
+
/* =>
146
+
3000
147
+
2500
148
+
1000
149
+
*/
150
+
133
151
next( null, false );
134
152
}
135
153
}
@@ -139,6 +157,7 @@ function done( error, bool ) {
139
157
throw error;
140
158
}
141
159
console.log( bool );
160
+
// => true
142
161
}
143
162
144
163
var arr = [ 3000, 2500, 1000 ];
@@ -148,12 +167,6 @@ var opts = {
148
167
};
149
168
150
169
noneByAsync( arr, opts, predicate, done );
151
-
/* =>
152
-
3000
153
-
2500
154
-
1000
155
-
true
156
-
*/
157
170
```
158
171
159
172
To limit the maximum number of pending function invocations, set the `limit` option.
@@ -163,6 +176,12 @@ function predicate( value, next ) {
163
176
setTimeout( onTimeout, value );
164
177
functiononTimeout() {
165
178
console.log( value );
179
+
/* =>
180
+
2500
181
+
3000
182
+
1000
183
+
*/
184
+
166
185
next( null, false );
167
186
}
168
187
}
@@ -172,6 +191,7 @@ function done( error, bool ) {
172
191
throw error;
173
192
}
174
193
console.log( bool );
194
+
// => true
175
195
}
176
196
177
197
var arr = [ 3000, 2500, 1000 ];
@@ -181,12 +201,6 @@ var opts = {
181
201
};
182
202
183
203
noneByAsync( arr, opts, predicate, done );
184
-
/* =>
185
-
2500
186
-
3000
187
-
1000
188
-
true
189
-
*/
190
204
```
191
205
192
206
To set the execution context of the `predicate` function, set the `thisArg` option.
@@ -236,9 +250,21 @@ The actual number of provided arguments depends on function `length`. If the `pr
236
250
```javascript
237
251
functionpredicate( value, i, collection, next ) {
238
252
console.log( 'collection: %s. %d: %d', collection.join( ',' ), i, value );
253
+
/* =>
254
+
collection: 3000,2500,1000. 0: 3000
255
+
collection: 3000,2500,1000. 1: 2500
256
+
collection: 3000,2500,1000. 2: 1000
257
+
*/
258
+
239
259
setTimeout( onTimeout, value );
240
260
functiononTimeout() {
241
261
console.log( value );
262
+
/* =>
263
+
1000
264
+
2500
265
+
3000
266
+
*/
267
+
242
268
next( null, false );
243
269
}
244
270
}
@@ -248,20 +274,12 @@ function done( error, bool ) {
248
274
throw error;
249
275
}
250
276
console.log( bool );
277
+
// => true
251
278
}
252
279
253
280
var arr = [ 3000, 2500, 1000 ];
254
281
255
282
noneByAsync( arr, predicate, done );
256
-
/* =>
257
-
collection: 3000,2500,1000. 0: 3000
258
-
collection: 3000,2500,1000. 1: 2500
259
-
collection: 3000,2500,1000. 2: 1000
260
-
1000
261
-
2500
262
-
3000
263
-
true
264
-
*/
265
283
```
266
284
267
285
#### noneByAsync.factory( \[options,] predicate )
@@ -289,7 +307,7 @@ var f = noneByAsync.factory( predicate );
0 commit comments