@stdlib/array-to-strided-iterator 0.0.6 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +0 -304
- package/NOTICE +1 -1
- package/README.md +28 -13
- package/SECURITY.md +5 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +7 -0
- package/docs/types/index.d.ts +3 -3
- package/lib/index.js +2 -2
- package/lib/main.js +17 -8
- package/package.json +25 -19
- package/docs/repl.txt +0 -64
- package/docs/types/test.ts +0 -99
package/LICENSE
CHANGED
|
@@ -175,307 +175,3 @@
|
|
|
175
175
|
of your accepting any such warranty or additional liability.
|
|
176
176
|
|
|
177
177
|
END OF TERMS AND CONDITIONS
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
Boost Software License - Version 1.0 - August 17th, 2003
|
|
182
|
-
|
|
183
|
-
Permission is hereby granted, free of charge, to any person or organization
|
|
184
|
-
obtaining a copy of the software and accompanying documentation covered by this
|
|
185
|
-
license (the "Software") to use, reproduce, display, distribute, execute, and
|
|
186
|
-
transmit the Software, and to prepare derivative works of the Software, and to
|
|
187
|
-
permit third-parties to whom the Software is furnished to do so, all subject to
|
|
188
|
-
the following:
|
|
189
|
-
|
|
190
|
-
The copyright notices in the Software and this entire statement, including the
|
|
191
|
-
above license grant, this restriction and the following disclaimer, must be
|
|
192
|
-
included in all copies of the Software, in whole or in part, and all derivative
|
|
193
|
-
works of the Software, unless such copies or derivative works are solely in the
|
|
194
|
-
form of machine-executable object code generated by a source language processor.
|
|
195
|
-
|
|
196
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
197
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
198
|
-
FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
|
199
|
-
COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES
|
|
200
|
-
OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
|
|
201
|
-
OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
DEPENDENCIES
|
|
207
|
-
|
|
208
|
-
The library links against the following external libraries, which have their own
|
|
209
|
-
licenses:
|
|
210
|
-
|
|
211
|
-
* OpenBLAS <https://raw.githubusercontent.com/xianyi/OpenBLAS/
|
|
212
|
-
def146efed8d5908ea04e22668feeab7099599a0/LICENSE>
|
|
213
|
-
|
|
214
|
-
Copyright (c) 2011-2014, The OpenBLAS Project
|
|
215
|
-
All rights reserved.
|
|
216
|
-
|
|
217
|
-
Redistribution and use in source and binary forms, with or without
|
|
218
|
-
modification, are permitted provided that the following conditions are
|
|
219
|
-
met:
|
|
220
|
-
|
|
221
|
-
1. Redistributions of source code must retain the above copyright
|
|
222
|
-
notice, this list of conditions and the following disclaimer.
|
|
223
|
-
|
|
224
|
-
2. Redistributions in binary form must reproduce the above copyright
|
|
225
|
-
notice, this list of conditions and the following disclaimer in
|
|
226
|
-
the documentation and/or other materials provided with the
|
|
227
|
-
distribution.
|
|
228
|
-
|
|
229
|
-
3. Neither the name of the OpenBLAS project nor the names of
|
|
230
|
-
its contributors may be used to endorse or promote products
|
|
231
|
-
derived from this software without specific prior written
|
|
232
|
-
permission.
|
|
233
|
-
|
|
234
|
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
235
|
-
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
236
|
-
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
237
|
-
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
|
238
|
-
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
239
|
-
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
|
240
|
-
GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
241
|
-
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
242
|
-
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
|
243
|
-
THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
* Electron <https://raw.githubusercontent.com/electron/electron/
|
|
247
|
-
c4cfb3e7110266b9d7ad80e1ae097c4db564501c/LICENSE>
|
|
248
|
-
|
|
249
|
-
Copyright (c) 2013-2017 GitHub Inc.
|
|
250
|
-
|
|
251
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
|
252
|
-
a copy of this software and associated documentation files (the
|
|
253
|
-
"Software"), to deal in the Software without restriction, including
|
|
254
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
|
255
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
|
256
|
-
permit persons to whom the Software is furnished to do so, subject to
|
|
257
|
-
the following conditions:
|
|
258
|
-
|
|
259
|
-
The above copyright notice and this permission notice shall be
|
|
260
|
-
included in all copies or substantial portions of the Software.
|
|
261
|
-
|
|
262
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
263
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
264
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
265
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
266
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
267
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
268
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
* Boost <http://www.boost.org/LICENSE_1_0.txt>
|
|
272
|
-
|
|
273
|
-
Boost Software License - Version 1.0 - August 17th, 2003
|
|
274
|
-
|
|
275
|
-
Permission is hereby granted, free of charge, to any person or organization
|
|
276
|
-
obtaining a copy of the software and accompanying documentation covered by
|
|
277
|
-
this license (the "Software") to use, reproduce, display, distribute,
|
|
278
|
-
execute, and transmit the Software, and to prepare derivative works of the
|
|
279
|
-
Software, and to permit third-parties to whom the Software is furnished to
|
|
280
|
-
do so, all subject to the following:
|
|
281
|
-
|
|
282
|
-
The copyright notices in the Software and this entire statement, including
|
|
283
|
-
the above license grant, this restriction and the following disclaimer,
|
|
284
|
-
must be included in all copies of the Software, in whole or in part, and
|
|
285
|
-
all derivative works of the Software, unless such copies or derivative
|
|
286
|
-
works are solely in the form of machine-executable object code generated by
|
|
287
|
-
a source language processor.
|
|
288
|
-
|
|
289
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
290
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
291
|
-
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
|
292
|
-
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
|
293
|
-
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
|
294
|
-
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
295
|
-
DEALINGS IN THE SOFTWARE.
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
* Cephes <http://www.netlib.org/cephes/readme>
|
|
299
|
-
|
|
300
|
-
Copyright (c) 1984-2000 Stephen L. Moshier
|
|
301
|
-
|
|
302
|
-
Some software in this archive may be from the book _Methods and Programs for
|
|
303
|
-
Mathematical Functions_ (Prentice-Hall or Simon & Schuster International, 1989)
|
|
304
|
-
or from the Cephes Mathematical Library, a commercial product. In either event,
|
|
305
|
-
it is copyrighted by the author. What you see here may be used freely but it
|
|
306
|
-
comes with no support or guarantee.
|
|
307
|
-
|
|
308
|
-
Stephen L. Moshier
|
|
309
|
-
moshier@na-net.ornl.gov
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
ATTRIBUTION
|
|
314
|
-
|
|
315
|
-
The library contains implementations from the following external libraries,
|
|
316
|
-
which have their own licenses:
|
|
317
|
-
|
|
318
|
-
* FreeBSD <https://svnweb.freebsd.org/>
|
|
319
|
-
|
|
320
|
-
Copyright (C) 1993-2004 by Sun Microsystems, Inc. All rights reserved.
|
|
321
|
-
|
|
322
|
-
Developed at SunPro, a Sun Microsystems, Inc. business.
|
|
323
|
-
Permission to use, copy, modify, and distribute this
|
|
324
|
-
software is freely granted, provided that this notice
|
|
325
|
-
is preserved.
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
* FDLIBM <http://www.netlib.org/fdlibm/>
|
|
329
|
-
|
|
330
|
-
Copyright (C) 2004 by Sun Microsystems, Inc. All rights reserved.
|
|
331
|
-
|
|
332
|
-
Developed at SunPro, a Sun Microsystems, Inc. business.
|
|
333
|
-
Permission to use, copy, modify, and distribute this
|
|
334
|
-
software is freely granted, provided that this notice
|
|
335
|
-
is preserved.
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
* Go <https://raw.githubusercontent.com/golang/go/master/LICENSE>
|
|
339
|
-
|
|
340
|
-
Copyright (c) 2009 The Go Authors. All rights reserved.
|
|
341
|
-
|
|
342
|
-
Redistribution and use in source and binary forms, with or without
|
|
343
|
-
modification, are permitted provided that the following conditions are
|
|
344
|
-
met:
|
|
345
|
-
|
|
346
|
-
* Redistributions of source code must retain the above copyright
|
|
347
|
-
notice, this list of conditions and the following disclaimer.
|
|
348
|
-
* Redistributions in binary form must reproduce the above
|
|
349
|
-
copyright notice, this list of conditions and the following disclaimer
|
|
350
|
-
in the documentation and/or other materials provided with the
|
|
351
|
-
distribution.
|
|
352
|
-
* Neither the name of Google Inc. nor the names of its
|
|
353
|
-
contributors may be used to endorse or promote products derived from
|
|
354
|
-
this software without specific prior written permission.
|
|
355
|
-
|
|
356
|
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
357
|
-
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
358
|
-
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
359
|
-
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
360
|
-
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
361
|
-
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
362
|
-
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
363
|
-
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
364
|
-
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
365
|
-
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
366
|
-
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
* SLATEC Common Mathematical Library <http://www.netlib.no/netlib/slatec/>
|
|
370
|
-
|
|
371
|
-
Public domain.
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
* ESLint <https://raw.githubusercontent.com/eslint/eslint/master/LICENSE>
|
|
375
|
-
|
|
376
|
-
Copyright JS Foundation and other contributors, https://js.foundation
|
|
377
|
-
|
|
378
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
379
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
380
|
-
in the Software without restriction, including without limitation the rights
|
|
381
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
382
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
383
|
-
furnished to do so, subject to the following conditions:
|
|
384
|
-
|
|
385
|
-
The above copyright notice and this permission notice shall be included in
|
|
386
|
-
all copies or substantial portions of the Software.
|
|
387
|
-
|
|
388
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
389
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
390
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
391
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
392
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
393
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
394
|
-
THE SOFTWARE.
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
* StatsFuns.jl <https://raw.githubusercontent.com/JuliaStats/StatsFuns.jl/
|
|
398
|
-
e66dd973650c375bc1739c820e5b96bb5bd000a8/LICENSE.md>
|
|
399
|
-
|
|
400
|
-
Copyright (c) 2015: Dahua Lin.
|
|
401
|
-
|
|
402
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
|
403
|
-
a copy of this software and associated documentation files (the
|
|
404
|
-
"Software"), to deal in the Software without restriction, including
|
|
405
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
|
406
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
|
407
|
-
permit persons to whom the Software is furnished to do so, subject to
|
|
408
|
-
the following conditions:
|
|
409
|
-
|
|
410
|
-
The above copyright notice and this permission notice shall be
|
|
411
|
-
included in all copies or substantial portions of the Software.
|
|
412
|
-
|
|
413
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
414
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
415
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
416
|
-
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
417
|
-
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
418
|
-
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
419
|
-
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
* SpecialFunctions.jl <https://raw.githubusercontent.com/JuliaMath/
|
|
423
|
-
SpecialFunctions.jl/02a173fbe24a61c4b392aec17a9764ac5727feb1/LICENSE>
|
|
424
|
-
|
|
425
|
-
The MIT License (MIT)
|
|
426
|
-
|
|
427
|
-
Copyright (c) 2017 Jeff Bezanson, Stefan Karpinski, Viral B. Shah, and others:
|
|
428
|
-
|
|
429
|
-
https://github.com/JuliaMath/SpecialFunctions.jl/graphs/contributors
|
|
430
|
-
|
|
431
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
432
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
433
|
-
in the Software without restriction, including without limitation the rights
|
|
434
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
435
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
436
|
-
furnished to do so, subject to the following conditions:
|
|
437
|
-
|
|
438
|
-
The above copyright notice and this permission notice shall be included in all
|
|
439
|
-
copies or substantial portions of the Software.
|
|
440
|
-
|
|
441
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
442
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
443
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
444
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
445
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
446
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
447
|
-
SOFTWARE.
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
* MT19937 <http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/MT2002/CODES/
|
|
451
|
-
mt19937ar.c>
|
|
452
|
-
|
|
453
|
-
Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura,
|
|
454
|
-
All rights reserved.
|
|
455
|
-
|
|
456
|
-
Redistribution and use in source and binary forms, with or without
|
|
457
|
-
modification, are permitted provided that the following conditions
|
|
458
|
-
are met:
|
|
459
|
-
|
|
460
|
-
1. Redistributions of source code must retain the above copyright
|
|
461
|
-
notice, this list of conditions and the following disclaimer.
|
|
462
|
-
|
|
463
|
-
2. Redistributions in binary form must reproduce the above copyright
|
|
464
|
-
notice, this list of conditions and the following disclaimer in the
|
|
465
|
-
documentation and/or other materials provided with the distribution.
|
|
466
|
-
|
|
467
|
-
3. The names of its contributors may not be used to endorse or promote
|
|
468
|
-
products derived from this software without specific prior written
|
|
469
|
-
permission.
|
|
470
|
-
|
|
471
|
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
472
|
-
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
473
|
-
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
474
|
-
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
475
|
-
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
476
|
-
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
477
|
-
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
478
|
-
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
479
|
-
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
480
|
-
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
481
|
-
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
package/NOTICE
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Copyright (c) 2016-
|
|
1
|
+
Copyright (c) 2016-2024 The Stdlib Authors.
|
package/README.md
CHANGED
|
@@ -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 <a href="https://github.com/stdlib-js/stdlib">GitHub</a>, and please consider <a href="https://opencollective.com/stdlib">financially supporting stdlib</a>. We greatly appreciate your continued support!</p>
|
|
30
|
+
</details>
|
|
31
|
+
|
|
21
32
|
# Strided Iterator
|
|
22
33
|
|
|
23
34
|
[![NPM version][npm-image]][npm-url] [![Build Status][test-image]][test-url] [![Coverage Status][coverage-image]][coverage-url] <!-- [![dependencies][dependencies-image]][dependencies-url] -->
|
|
@@ -174,7 +185,7 @@ var count = ctx.count;
|
|
|
174
185
|
- If provided a generic `array`, the returned [iterator][mdn-iterator-protocol] does **not** ignore holes. To achieve greater performance for sparse arrays, use a custom [iterator][mdn-iterator-protocol].
|
|
175
186
|
- A returned [iterator][mdn-iterator-protocol] does **not** copy a provided array-like `object`. To ensure iterable reproducibility, copy a provided array-like `object` **before** creating an [iterator][mdn-iterator-protocol]. Otherwise, any changes to the contents of an array-like `object` will be reflected in the returned [iterator][mdn-iterator-protocol].
|
|
176
187
|
- In environments supporting `Symbol.iterator`, the function **explicitly** does **not** invoke an array's `@@iterator` method, regardless of whether this method is defined. To convert an array to an implementation defined [iterator][mdn-iterator-protocol], invoke this method directly.
|
|
177
|
-
- The returned [iterator][mdn-iterator-protocol] supports array-like objects having getter and setter accessors for array element access (e.g., [`@stdlib/array
|
|
188
|
+
- The returned [iterator][mdn-iterator-protocol] supports array-like objects having getter and setter accessors for array element access (e.g., [`@stdlib/array-complex64`][@stdlib/array/complex64]).
|
|
178
189
|
|
|
179
190
|
</section>
|
|
180
191
|
|
|
@@ -235,8 +246,8 @@ while ( true ) {
|
|
|
235
246
|
|
|
236
247
|
## See Also
|
|
237
248
|
|
|
238
|
-
- <span class="package-name">[`@stdlib/array
|
|
239
|
-
- <span class="package-name">[`@stdlib/array
|
|
249
|
+
- <span class="package-name">[`@stdlib/array-from-iterator`][@stdlib/array/from-iterator]</span><span class="delimiter">: </span><span class="description">create (or fill) an array from an iterator.</span>
|
|
250
|
+
- <span class="package-name">[`@stdlib/array-to-iterator`][@stdlib/array/to-iterator]</span><span class="delimiter">: </span><span class="description">create an iterator from an array-like object.</span>
|
|
240
251
|
|
|
241
252
|
</section>
|
|
242
253
|
|
|
@@ -268,7 +279,7 @@ See [LICENSE][stdlib-license].
|
|
|
268
279
|
|
|
269
280
|
## Copyright
|
|
270
281
|
|
|
271
|
-
Copyright © 2016-
|
|
282
|
+
Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors].
|
|
272
283
|
|
|
273
284
|
</section>
|
|
274
285
|
|
|
@@ -281,8 +292,8 @@ Copyright © 2016-2022. The Stdlib [Authors][stdlib-authors].
|
|
|
281
292
|
[npm-image]: http://img.shields.io/npm/v/@stdlib/array-to-strided-iterator.svg
|
|
282
293
|
[npm-url]: https://npmjs.org/package/@stdlib/array-to-strided-iterator
|
|
283
294
|
|
|
284
|
-
[test-image]: https://github.com/stdlib-js/array-to-strided-iterator/actions/workflows/test.yml/badge.svg
|
|
285
|
-
[test-url]: https://github.com/stdlib-js/array-to-strided-iterator/actions/workflows/test.yml
|
|
295
|
+
[test-image]: https://github.com/stdlib-js/array-to-strided-iterator/actions/workflows/test.yml/badge.svg?branch=v0.2.0
|
|
296
|
+
[test-url]: https://github.com/stdlib-js/array-to-strided-iterator/actions/workflows/test.yml?query=branch:v0.2.0
|
|
286
297
|
|
|
287
298
|
[coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/array-to-strided-iterator/main.svg
|
|
288
299
|
[coverage-url]: https://codecov.io/github/stdlib-js/array-to-strided-iterator?branch=main
|
|
@@ -294,19 +305,23 @@ Copyright © 2016-2022. The Stdlib [Authors][stdlib-authors].
|
|
|
294
305
|
|
|
295
306
|
-->
|
|
296
307
|
|
|
308
|
+
[chat-image]: https://img.shields.io/gitter/room/stdlib-js/stdlib.svg
|
|
309
|
+
[chat-url]: https://app.gitter.im/#/room/#stdlib-js_stdlib:gitter.im
|
|
310
|
+
|
|
311
|
+
[stdlib]: https://github.com/stdlib-js/stdlib
|
|
312
|
+
|
|
313
|
+
[stdlib-authors]: https://github.com/stdlib-js/stdlib/graphs/contributors
|
|
314
|
+
|
|
297
315
|
[umd]: https://github.com/umdjs/umd
|
|
298
316
|
[es-module]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules
|
|
299
317
|
|
|
300
318
|
[deno-url]: https://github.com/stdlib-js/array-to-strided-iterator/tree/deno
|
|
319
|
+
[deno-readme]: https://github.com/stdlib-js/array-to-strided-iterator/blob/deno/README.md
|
|
301
320
|
[umd-url]: https://github.com/stdlib-js/array-to-strided-iterator/tree/umd
|
|
321
|
+
[umd-readme]: https://github.com/stdlib-js/array-to-strided-iterator/blob/umd/README.md
|
|
302
322
|
[esm-url]: https://github.com/stdlib-js/array-to-strided-iterator/tree/esm
|
|
303
|
-
|
|
304
|
-
[
|
|
305
|
-
[chat-url]: https://gitter.im/stdlib-js/stdlib/
|
|
306
|
-
|
|
307
|
-
[stdlib]: https://github.com/stdlib-js/stdlib
|
|
308
|
-
|
|
309
|
-
[stdlib-authors]: https://github.com/stdlib-js/stdlib/graphs/contributors
|
|
323
|
+
[esm-readme]: https://github.com/stdlib-js/array-to-strided-iterator/blob/esm/README.md
|
|
324
|
+
[branches-url]: https://github.com/stdlib-js/array-to-strided-iterator/blob/main/branches.md
|
|
310
325
|
|
|
311
326
|
[stdlib-license]: https://raw.githubusercontent.com/stdlib-js/array-to-strided-iterator/main/LICENSE
|
|
312
327
|
|
package/SECURITY.md
ADDED
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";var E=function(r,e){return function(){return e||r((e={exports:{}}).exports,e),e.exports}};var w=E(function(C,h){
|
|
2
|
+
var m=require('@stdlib/utils-define-nonenumerable-read-only-property/dist'),F=require('@stdlib/assert-is-function/dist'),V=require('@stdlib/assert-is-collection/dist'),y=require('@stdlib/assert-is-nonnegative-integer/dist').isPrimitive,A=require('@stdlib/assert-is-integer/dist').isPrimitive,G=require('@stdlib/array-base-assert-is-accessor-array/dist'),c=require('@stdlib/symbol-iterator/dist'),I=require('@stdlib/array-base-accessor-getter/dist'),P=require('@stdlib/array-base-getter/dist'),S=require('@stdlib/array-dtype/dist'),g=require('@stdlib/error-tools-fmtprodmsg/dist');function q(r,e,a,o){var s,i,f,t,u,l,d,v;if(!y(r))throw new TypeError(g('01h2d',r));if(!V(e))throw new TypeError(g('01h2y',e));if(!A(a))throw new TypeError(g('01h2z',a));if(!y(o))throw new TypeError(g('01h30',o));if(arguments.length>4){if(t=arguments[4],!F(t))throw new TypeError(g('01h31',t));s=arguments[5]}return u=o,v=-1,i={},t?m(i,"next",p):m(i,"next",b),m(i,"return",x),c&&m(i,c,T),d=S(e),G(e)?l=I(d):l=P(d),i;function p(){var n;return v+=1,f||v>=r?{done:!0}:(n=t.call(s,l(e,u),u,v,e),u+=a,{value:n,done:!1})}function b(){var n;return v+=1,f||v>=r?{done:!0}:(n=l(e,u),u+=a,{value:n,done:!1})}function x(n){return f=!0,arguments.length?{value:n,done:!0}:{done:!0}}function T(){return t?q(r,e,a,o,t,s):q(r,e,a,o)}}h.exports=q
|
|
3
|
+
});var j=w();module.exports=j;
|
|
4
|
+
/** @license Apache-2.0 */
|
|
5
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../lib/main.js", "../lib/index.js"],
|
|
4
|
+
"sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar isFunction = require( '@stdlib/assert-is-function' );\nvar isCollection = require( '@stdlib/assert-is-collection' );\nvar isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' ).isPrimitive;\nvar isInteger = require( '@stdlib/assert-is-integer' ).isPrimitive;\nvar isAccessorArray = require( '@stdlib/array-base-assert-is-accessor-array' );\nvar iteratorSymbol = require( '@stdlib/symbol-iterator' );\nvar accessorGetter = require( '@stdlib/array-base-accessor-getter' );\nvar getter = require( '@stdlib/array-base-getter' );\nvar dtype = require( '@stdlib/array-dtype' );\nvar format = require( '@stdlib/string-format' );\n\n\n// MAIN //\n\n/**\n* Returns an iterator which iterates over elements in an array-like object according to specified stride parameters.\n*\n* @param {NonNegativeInteger} N - number of values to iterate\n* @param {Collection} src - input value\n* @param {integer} stride - stride length\n* @param {NonNegativeInteger} offset - starting index\n* @param {Function} [mapFcn] - function to invoke for each iterated value\n* @param {*} [thisArg] - execution context\n* @throws {TypeError} first argument must be a nonnegative integer\n* @throws {TypeError} second argument must be an array-like object\n* @throws {TypeError} third argument must be an integer\n* @throws {TypeError} fourth argument must be a nonnegative integer\n* @throws {TypeError} fifth argument must be a function\n* @returns {Iterator} iterator\n*\n* @example\n* var values = [ 1, 2, 3, 4, 5, 6, 7, 8 ];\n*\n* var N = 4;\n* var stride = -2;\n* var offset = 6;\n*\n* var iter = stridedarray2iterator( N, values, stride, offset );\n*\n* var v = iter.next().value;\n* // returns 7\n*\n* v = iter.next().value;\n* // returns 5\n*\n* v = iter.next().value;\n* // returns 3\n*\n* // ...\n*/\nfunction stridedarray2iterator( N, src, stride, offset ) {\n\tvar thisArg;\n\tvar iter;\n\tvar FLG;\n\tvar fcn;\n\tvar idx;\n\tvar get;\n\tvar dt;\n\tvar i;\n\tif ( !isNonNegativeInteger( N ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a nonnegative integer. Value: `%s`.', N ) );\n\t}\n\tif ( !isCollection( src ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Second argument must be an array-like object. Value: `%s`.', src ) );\n\t}\n\tif ( !isInteger( stride ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Third argument must be an integer. Value: `%s`.', stride ) );\n\t}\n\tif ( !isNonNegativeInteger( offset ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Fourth argument must be a nonnegative integer. Value: `%s`.', offset ) );\n\t}\n\tif ( arguments.length > 4 ) {\n\t\tfcn = arguments[ 4 ];\n\t\tif ( !isFunction( fcn ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Fifth argument must be a function. Value: `%s`.', fcn ) );\n\t\t}\n\t\tthisArg = arguments[ 5 ];\n\t}\n\tidx = offset;\n\ti = -1;\n\n\t// Create an iterator protocol-compliant object:\n\titer = {};\n\tif ( fcn ) {\n\t\tsetReadOnly( iter, 'next', next1 );\n\t} else {\n\t\tsetReadOnly( iter, 'next', next2 );\n\t}\n\tsetReadOnly( iter, 'return', end );\n\n\t// If an environment supports `Symbol.iterator`, make the iterator iterable:\n\tif ( iteratorSymbol ) {\n\t\tsetReadOnly( iter, iteratorSymbol, factory );\n\t}\n\t// Resolve an accessor for retrieving array elements (e.g., to accommodate `Complex64Array`, etc):\n\tdt = dtype( src );\n\tif ( isAccessorArray( src ) ) {\n\t\tget = accessorGetter( dt );\n\t} else {\n\t\tget = getter( dt );\n\t}\n\treturn iter;\n\n\t/**\n\t* Returns an iterator protocol-compliant object containing the next iterated value.\n\t*\n\t* @private\n\t* @returns {Object} iterator protocol-compliant object\n\t*/\n\tfunction next1() {\n\t\tvar v;\n\t\ti += 1;\n\t\tif ( FLG || i >= N ) {\n\t\t\treturn {\n\t\t\t\t'done': true\n\t\t\t};\n\t\t}\n\t\tv = fcn.call( thisArg, get( src, idx ), idx, i, src );\n\t\tidx += stride;\n\t\treturn {\n\t\t\t'value': v,\n\t\t\t'done': false\n\t\t};\n\t}\n\n\t/**\n\t* Returns an iterator protocol-compliant object containing the next iterated value.\n\t*\n\t* @private\n\t* @returns {Object} iterator protocol-compliant object\n\t*/\n\tfunction next2() {\n\t\tvar v;\n\t\ti += 1;\n\t\tif ( FLG || i >= N ) {\n\t\t\treturn {\n\t\t\t\t'done': true\n\t\t\t};\n\t\t}\n\t\tv = get( src, idx );\n\t\tidx += stride;\n\t\treturn {\n\t\t\t'value': v,\n\t\t\t'done': false\n\t\t};\n\t}\n\n\t/**\n\t* Finishes an iterator.\n\t*\n\t* @private\n\t* @param {*} [value] - value to return\n\t* @returns {Object} iterator protocol-compliant object\n\t*/\n\tfunction end( value ) {\n\t\tFLG = true;\n\t\tif ( arguments.length ) {\n\t\t\treturn {\n\t\t\t\t'value': value,\n\t\t\t\t'done': true\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\t'done': true\n\t\t};\n\t}\n\n\t/**\n\t* Returns a new iterator.\n\t*\n\t* @private\n\t* @returns {Iterator} iterator\n\t*/\n\tfunction factory() {\n\t\tif ( fcn ) {\n\t\t\treturn stridedarray2iterator( N, src, stride, offset, fcn, thisArg ); // eslint-disable-line max-len\n\t\t}\n\t\treturn stridedarray2iterator( N, src, stride, offset );\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = stridedarray2iterator;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Create an iterator from a strided array-like value.\n*\n* @module @stdlib/array-to-strided-iterator\n*\n* @example\n* var stridedarray2iterator = require( '@stdlib/array-to-strided-iterator' );\n*\n* var values = [ 1, 2, 3, 4, 5, 6, 7, 8 ];\n*\n* var N = 4;\n* var stride = -2;\n* var offset = 6;\n*\n* var iter = stridedarray2iterator( N, values, stride, offset );\n*\n* var v = iter.next().value;\n* // returns 7\n*\n* v = iter.next().value;\n* // returns 5\n*\n* v = iter.next().value;\n* // returns 3\n*\n* // ...\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"],
|
|
5
|
+
"mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAc,QAAS,uDAAwD,EAC/EC,EAAa,QAAS,4BAA6B,EACnDC,EAAe,QAAS,8BAA+B,EACvDC,EAAuB,QAAS,uCAAwC,EAAE,YAC1EC,EAAY,QAAS,2BAA4B,EAAE,YACnDC,EAAkB,QAAS,6CAA8C,EACzEC,EAAiB,QAAS,yBAA0B,EACpDC,EAAiB,QAAS,oCAAqC,EAC/DC,EAAS,QAAS,2BAA4B,EAC9CC,EAAQ,QAAS,qBAAsB,EACvCC,EAAS,QAAS,uBAAwB,EAyC9C,SAASC,EAAuBC,EAAGC,EAAKC,EAAQC,EAAS,CACxD,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACJ,GAAK,CAACpB,EAAsBS,CAAE,EAC7B,MAAM,IAAI,UAAWF,EAAQ,+EAAgFE,CAAE,CAAE,EAElH,GAAK,CAACV,EAAcW,CAAI,EACvB,MAAM,IAAI,UAAWH,EAAQ,+EAAgFG,CAAI,CAAE,EAEpH,GAAK,CAACT,EAAWU,CAAO,EACvB,MAAM,IAAI,UAAWJ,EAAQ,oEAAqEI,CAAO,CAAE,EAE5G,GAAK,CAACX,EAAsBY,CAAO,EAClC,MAAM,IAAI,UAAWL,EAAQ,gFAAiFK,CAAO,CAAE,EAExH,GAAK,UAAU,OAAS,EAAI,CAE3B,GADAI,EAAM,UAAW,CAAE,EACd,CAAClB,EAAYkB,CAAI,EACrB,MAAM,IAAI,UAAWT,EAAQ,oEAAqES,CAAI,CAAE,EAEzGH,EAAU,UAAW,CAAE,CACxB,CACA,OAAAI,EAAML,EACNQ,EAAI,GAGJN,EAAO,CAAC,EACHE,EACJnB,EAAaiB,EAAM,OAAQO,CAAM,EAEjCxB,EAAaiB,EAAM,OAAQQ,CAAM,EAElCzB,EAAaiB,EAAM,SAAUS,CAAI,EAG5BpB,GACJN,EAAaiB,EAAMX,EAAgBqB,CAAQ,EAG5CL,EAAKb,EAAOI,CAAI,EACXR,EAAiBQ,CAAI,EACzBQ,EAAMd,EAAgBe,CAAG,EAEzBD,EAAMb,EAAQc,CAAG,EAEXL,EAQP,SAASO,GAAQ,CAChB,IAAII,EAEJ,OADAL,GAAK,EACAL,GAAOK,GAAKX,EACT,CACN,KAAQ,EACT,GAEDgB,EAAIT,EAAI,KAAMH,EAASK,EAAKR,EAAKO,CAAI,EAAGA,EAAKG,EAAGV,CAAI,EACpDO,GAAON,EACA,CACN,MAASc,EACT,KAAQ,EACT,EACD,CAQA,SAASH,GAAQ,CAChB,IAAIG,EAEJ,OADAL,GAAK,EACAL,GAAOK,GAAKX,EACT,CACN,KAAQ,EACT,GAEDgB,EAAIP,EAAKR,EAAKO,CAAI,EAClBA,GAAON,EACA,CACN,MAASc,EACT,KAAQ,EACT,EACD,CASA,SAASF,EAAKG,EAAQ,CAErB,OADAX,EAAM,GACD,UAAU,OACP,CACN,MAASW,EACT,KAAQ,EACT,EAEM,CACN,KAAQ,EACT,CACD,CAQA,SAASF,GAAU,CAClB,OAAKR,EACGR,EAAuBC,EAAGC,EAAKC,EAAQC,EAAQI,EAAKH,CAAQ,EAE7DL,EAAuBC,EAAGC,EAAKC,EAAQC,CAAO,CACtD,CACD,CAKAhB,EAAO,QAAUY,IC7JjB,IAAImB,EAAO,IAKX,OAAO,QAAUA",
|
|
6
|
+
"names": ["require_main", "__commonJSMin", "exports", "module", "setReadOnly", "isFunction", "isCollection", "isNonNegativeInteger", "isInteger", "isAccessorArray", "iteratorSymbol", "accessorGetter", "getter", "dtype", "format", "stridedarray2iterator", "N", "src", "stride", "offset", "thisArg", "iter", "FLG", "fcn", "idx", "get", "dt", "i", "next1", "next2", "end", "factory", "v", "value", "main"]
|
|
7
|
+
}
|
package/docs/types/index.d.ts
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
-
// TypeScript Version:
|
|
19
|
+
// TypeScript Version: 4.1
|
|
20
20
|
|
|
21
21
|
/// <reference types="@stdlib/types"/>
|
|
22
22
|
|
|
@@ -69,7 +69,7 @@ type Ternary = ( value: any, index: number, n: number ) => any;
|
|
|
69
69
|
* @param src - source array-like object
|
|
70
70
|
* @returns iterator value
|
|
71
71
|
*/
|
|
72
|
-
type Quaternary = ( value: any, index: number, n: number, src: ArrayLike<any> ) => any;
|
|
72
|
+
type Quaternary = ( value: any, index: number, n: number, src: ArrayLike<any> ) => any;
|
|
73
73
|
|
|
74
74
|
/**
|
|
75
75
|
* Map function invoked for each iterated value.
|
|
@@ -116,7 +116,7 @@ type MapFunction = Nullary | Unary | Binary | Ternary | Quaternary;
|
|
|
116
116
|
*
|
|
117
117
|
* // ...
|
|
118
118
|
*/
|
|
119
|
-
declare function stridedarray2iterator( N: number, src: ArrayLike<any>, stride: number, offset: number, mapFcn?: MapFunction, thisArg?: any ): Iterator;
|
|
119
|
+
declare function stridedarray2iterator( N: number, src: ArrayLike<any>, stride: number, offset: number, mapFcn?: MapFunction, thisArg?: any ): Iterator;
|
|
120
120
|
|
|
121
121
|
|
|
122
122
|
// EXPORTS //
|
package/lib/index.js
CHANGED
package/lib/main.js
CHANGED
|
@@ -25,8 +25,12 @@ var isFunction = require( '@stdlib/assert-is-function' );
|
|
|
25
25
|
var isCollection = require( '@stdlib/assert-is-collection' );
|
|
26
26
|
var isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' ).isPrimitive;
|
|
27
27
|
var isInteger = require( '@stdlib/assert-is-integer' ).isPrimitive;
|
|
28
|
+
var isAccessorArray = require( '@stdlib/array-base-assert-is-accessor-array' );
|
|
28
29
|
var iteratorSymbol = require( '@stdlib/symbol-iterator' );
|
|
29
|
-
var
|
|
30
|
+
var accessorGetter = require( '@stdlib/array-base-accessor-getter' );
|
|
31
|
+
var getter = require( '@stdlib/array-base-getter' );
|
|
32
|
+
var dtype = require( '@stdlib/array-dtype' );
|
|
33
|
+
var format = require( '@stdlib/string-format' );
|
|
30
34
|
|
|
31
35
|
|
|
32
36
|
// MAIN //
|
|
@@ -74,23 +78,24 @@ function stridedarray2iterator( N, src, stride, offset ) {
|
|
|
74
78
|
var fcn;
|
|
75
79
|
var idx;
|
|
76
80
|
var get;
|
|
81
|
+
var dt;
|
|
77
82
|
var i;
|
|
78
83
|
if ( !isNonNegativeInteger( N ) ) {
|
|
79
|
-
throw new TypeError( 'invalid argument. First argument must be a nonnegative integer. Value:
|
|
84
|
+
throw new TypeError( format( 'invalid argument. First argument must be a nonnegative integer. Value: `%s`.', N ) );
|
|
80
85
|
}
|
|
81
86
|
if ( !isCollection( src ) ) {
|
|
82
|
-
throw new TypeError( 'invalid argument. Second argument must be an array-like object. Value:
|
|
87
|
+
throw new TypeError( format( 'invalid argument. Second argument must be an array-like object. Value: `%s`.', src ) );
|
|
83
88
|
}
|
|
84
89
|
if ( !isInteger( stride ) ) {
|
|
85
|
-
throw new TypeError( 'invalid argument. Third argument must be an integer. Value:
|
|
90
|
+
throw new TypeError( format( 'invalid argument. Third argument must be an integer. Value: `%s`.', stride ) );
|
|
86
91
|
}
|
|
87
92
|
if ( !isNonNegativeInteger( offset ) ) {
|
|
88
|
-
throw new TypeError( 'invalid argument. Fourth argument must be a nonnegative integer. Value:
|
|
93
|
+
throw new TypeError( format( 'invalid argument. Fourth argument must be a nonnegative integer. Value: `%s`.', offset ) );
|
|
89
94
|
}
|
|
90
95
|
if ( arguments.length > 4 ) {
|
|
91
96
|
fcn = arguments[ 4 ];
|
|
92
97
|
if ( !isFunction( fcn ) ) {
|
|
93
|
-
throw new TypeError( 'invalid argument. Fifth argument must be a function. Value:
|
|
98
|
+
throw new TypeError( format( 'invalid argument. Fifth argument must be a function. Value: `%s`.', fcn ) );
|
|
94
99
|
}
|
|
95
100
|
thisArg = arguments[ 5 ];
|
|
96
101
|
}
|
|
@@ -111,8 +116,12 @@ function stridedarray2iterator( N, src, stride, offset ) {
|
|
|
111
116
|
setReadOnly( iter, iteratorSymbol, factory );
|
|
112
117
|
}
|
|
113
118
|
// Resolve an accessor for retrieving array elements (e.g., to accommodate `Complex64Array`, etc):
|
|
114
|
-
|
|
115
|
-
|
|
119
|
+
dt = dtype( src );
|
|
120
|
+
if ( isAccessorArray( src ) ) {
|
|
121
|
+
get = accessorGetter( dt );
|
|
122
|
+
} else {
|
|
123
|
+
get = getter( dt );
|
|
124
|
+
}
|
|
116
125
|
return iter;
|
|
117
126
|
|
|
118
127
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stdlib/array-to-strided-iterator",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Create an iterator from a strided array-like object.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": {
|
|
@@ -37,27 +37,33 @@
|
|
|
37
37
|
"url": "https://github.com/stdlib-js/stdlib/issues"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@stdlib/array-base-
|
|
41
|
-
"@stdlib/assert-is-
|
|
42
|
-
"@stdlib/
|
|
43
|
-
"@stdlib/
|
|
44
|
-
"@stdlib/assert-is-
|
|
45
|
-
"@stdlib/
|
|
46
|
-
"@stdlib/
|
|
47
|
-
"@stdlib/
|
|
40
|
+
"@stdlib/array-base-accessor-getter": "^0.2.0",
|
|
41
|
+
"@stdlib/array-base-assert-is-accessor-array": "^0.2.0",
|
|
42
|
+
"@stdlib/array-base-getter": "^0.2.0",
|
|
43
|
+
"@stdlib/array-dtype": "^0.2.0",
|
|
44
|
+
"@stdlib/assert-is-collection": "^0.2.0",
|
|
45
|
+
"@stdlib/assert-is-function": "^0.2.0",
|
|
46
|
+
"@stdlib/assert-is-integer": "^0.2.0",
|
|
47
|
+
"@stdlib/assert-is-nonnegative-integer": "^0.2.0",
|
|
48
|
+
"@stdlib/string-format": "^0.2.0",
|
|
49
|
+
"@stdlib/symbol-iterator": "^0.2.0",
|
|
50
|
+
"@stdlib/types": "^0.3.1",
|
|
51
|
+
"@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.0",
|
|
52
|
+
"@stdlib/error-tools-fmtprodmsg": "^0.2.0"
|
|
48
53
|
},
|
|
49
54
|
"devDependencies": {
|
|
50
|
-
"@stdlib/array-float64": "^0.0
|
|
51
|
-
"@stdlib/assert-is-iterator-like": "^0.0
|
|
52
|
-
"@stdlib/
|
|
53
|
-
"@stdlib/
|
|
54
|
-
"@stdlib/
|
|
55
|
-
"@stdlib/utils-
|
|
56
|
-
"@stdlib/utils-noop": "^0.0.x",
|
|
55
|
+
"@stdlib/array-float64": "^0.2.0",
|
|
56
|
+
"@stdlib/assert-is-iterator-like": "^0.2.0",
|
|
57
|
+
"@stdlib/math-base-assert-is-nan": "^0.2.0",
|
|
58
|
+
"@stdlib/random-base-randu": "^0.1.0",
|
|
59
|
+
"@stdlib/utils-inmap": "^0.2.0",
|
|
60
|
+
"@stdlib/utils-noop": "^0.2.0",
|
|
57
61
|
"proxyquire": "^2.0.0",
|
|
58
62
|
"tape": "git+https://github.com/kgryte/tape.git#fix/globby",
|
|
59
63
|
"istanbul": "^0.4.1",
|
|
60
|
-
"tap-
|
|
64
|
+
"tap-min": "git+https://github.com/Planeshifter/tap-min.git",
|
|
65
|
+
"@stdlib/bench-harness": "^0.2.0",
|
|
66
|
+
"@stdlib/bench": "^0.3.1"
|
|
61
67
|
},
|
|
62
68
|
"engines": {
|
|
63
69
|
"node": ">=0.10.0",
|
|
@@ -99,7 +105,7 @@
|
|
|
99
105
|
"multidimensional"
|
|
100
106
|
],
|
|
101
107
|
"funding": {
|
|
102
|
-
"type": "
|
|
103
|
-
"url": "https://
|
|
108
|
+
"type": "opencollective",
|
|
109
|
+
"url": "https://opencollective.com/stdlib"
|
|
104
110
|
}
|
|
105
111
|
}
|
package/docs/repl.txt
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
{{alias}}( N, src, stride, offset[, mapFcn[, thisArg]] )
|
|
3
|
-
Returns an iterator which iterates over elements of an array-like object
|
|
4
|
-
according to specified stride parameters.
|
|
5
|
-
|
|
6
|
-
When invoked, an input function is provided four arguments:
|
|
7
|
-
|
|
8
|
-
- value: iterated value
|
|
9
|
-
- index: iterated value index
|
|
10
|
-
- n: iteration count (zero-based)
|
|
11
|
-
- src: source array-like object
|
|
12
|
-
|
|
13
|
-
If an environment supports Symbol.iterator, the returned iterator is
|
|
14
|
-
iterable.
|
|
15
|
-
|
|
16
|
-
If an environment supports Symbol.iterator, the function explicitly does not
|
|
17
|
-
not invoke an array's `@@iterator` method, regardless of whether this method
|
|
18
|
-
is defined. To convert an array to an implementation defined iterator,
|
|
19
|
-
invoke this method directly.
|
|
20
|
-
|
|
21
|
-
Parameters
|
|
22
|
-
----------
|
|
23
|
-
N: integer
|
|
24
|
-
Number of values to iterate.
|
|
25
|
-
|
|
26
|
-
src: ArrayLikeObject
|
|
27
|
-
Array-like object from which to create the iterator.
|
|
28
|
-
|
|
29
|
-
stride: integer
|
|
30
|
-
Stride length.
|
|
31
|
-
|
|
32
|
-
offset: integer
|
|
33
|
-
Starting index.
|
|
34
|
-
|
|
35
|
-
mapFcn: Function (optional)
|
|
36
|
-
Function to invoke for each iterated value.
|
|
37
|
-
|
|
38
|
-
thisArg: any (optional)
|
|
39
|
-
Execution context.
|
|
40
|
-
|
|
41
|
-
Returns
|
|
42
|
-
-------
|
|
43
|
-
iterator: Object
|
|
44
|
-
Iterator.
|
|
45
|
-
|
|
46
|
-
iterator.next(): Function
|
|
47
|
-
Returns an iterator protocol-compliant object containing the next
|
|
48
|
-
iterated value (if one exists) and a boolean flag indicating whether the
|
|
49
|
-
iterator is finished.
|
|
50
|
-
|
|
51
|
-
iterator.return( [value] ): Function
|
|
52
|
-
Finishes an iterator and returns a provided value.
|
|
53
|
-
|
|
54
|
-
Examples
|
|
55
|
-
--------
|
|
56
|
-
> var it = {{alias}}( 2, [ 1, 2, 3, 4 ], -2, 3 );
|
|
57
|
-
> var v = it.next().value
|
|
58
|
-
4
|
|
59
|
-
> v = it.next().value
|
|
60
|
-
2
|
|
61
|
-
|
|
62
|
-
See Also
|
|
63
|
-
--------
|
|
64
|
-
|
package/docs/types/test.ts
DELETED
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* @license Apache-2.0
|
|
3
|
-
*
|
|
4
|
-
* Copyright (c) 2021 The Stdlib Authors.
|
|
5
|
-
*
|
|
6
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
-
* you may not use this file except in compliance with the License.
|
|
8
|
-
* You may obtain a copy of the License at
|
|
9
|
-
*
|
|
10
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
-
*
|
|
12
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
-
* See the License for the specific language governing permissions and
|
|
16
|
-
* limitations under the License.
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
import stridedarray2iterator = require( './index' );
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Multiplies a value by 10.
|
|
23
|
-
*
|
|
24
|
-
* @param v - iterated value
|
|
25
|
-
* @returns new value
|
|
26
|
-
*/
|
|
27
|
-
function times10( v: number ): number {
|
|
28
|
-
return v * 10.0;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
// TESTS //
|
|
33
|
-
|
|
34
|
-
// The function returns an iterator...
|
|
35
|
-
{
|
|
36
|
-
stridedarray2iterator( 2, [ 1, 2, 3, 4 ], -2, 3 ); // $ExpectType Iterator
|
|
37
|
-
stridedarray2iterator( 4, [ 1, 2, 3, 4, 5, 6, 7, 8 ], -2, 6, times10 ); // $ExpectType Iterator
|
|
38
|
-
stridedarray2iterator( 2, [ 1, 2, 3, 4 ], -2, 3, times10, {} ); // $ExpectType Iterator
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
// The compiler throws an error if the function is provided a first argument which is not a number...
|
|
42
|
-
{
|
|
43
|
-
stridedarray2iterator( 'abc', [ 1, 2, 3, 4 ], -2, 3 ); // $ExpectError
|
|
44
|
-
stridedarray2iterator( true, [ 1, 2, 3, 4 ], -2, 3 ); // $ExpectError
|
|
45
|
-
stridedarray2iterator( false, [ 1, 2, 3, 4 ], -2, 3 ); // $ExpectError
|
|
46
|
-
stridedarray2iterator( {}, [ 1, 2, 3, 4 ], -2, 3 ); // $ExpectError
|
|
47
|
-
stridedarray2iterator( null, [ 1, 2, 3, 4 ], -2, 3 ); // $ExpectError
|
|
48
|
-
stridedarray2iterator( undefined, [ 1, 2, 3, 4 ], -2, 3 ); // $ExpectError
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
// The compiler throws an error if the function is provided a second argument which is not array-like...
|
|
52
|
-
{
|
|
53
|
-
stridedarray2iterator( 2, 123, -2, 3 ); // $ExpectError
|
|
54
|
-
stridedarray2iterator( 2, true, -2, 3 ); // $ExpectError
|
|
55
|
-
stridedarray2iterator( 2, false, -2, 3 ); // $ExpectError
|
|
56
|
-
stridedarray2iterator( 2, {}, -2, 3 ); // $ExpectError
|
|
57
|
-
stridedarray2iterator( 2, null, -2, 3 ); // $ExpectError
|
|
58
|
-
stridedarray2iterator( 2, undefined, -2, 3 ); // $ExpectError
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
// The compiler throws an error if the function is provided a third argument which is not a number...
|
|
62
|
-
{
|
|
63
|
-
stridedarray2iterator( 2, [ 1, 2, 3, 4 ], 'abc', 3 ); // $ExpectError
|
|
64
|
-
stridedarray2iterator( 2, [ 1, 2, 3, 4 ], true, 3 ); // $ExpectError
|
|
65
|
-
stridedarray2iterator( 2, [ 1, 2, 3, 4 ], false, 3 ); // $ExpectError
|
|
66
|
-
stridedarray2iterator( 2, [ 1, 2, 3, 4 ], {}, 3 ); // $ExpectError
|
|
67
|
-
stridedarray2iterator( 2, [ 1, 2, 3, 4 ], null, 3 ); // $ExpectError
|
|
68
|
-
stridedarray2iterator( 2, [ 1, 2, 3, 4 ], undefined, 3 ); // $ExpectError
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
// The compiler throws an error if the function is provided a fourth argument which is not a number...
|
|
72
|
-
{
|
|
73
|
-
stridedarray2iterator( 2, [ 1, 2, 3, 4 ], -2, 'abc' ); // $ExpectError
|
|
74
|
-
stridedarray2iterator( 2, [ 1, 2, 3, 4 ], -2, true ); // $ExpectError
|
|
75
|
-
stridedarray2iterator( 2, [ 1, 2, 3, 4 ], -2, false ); // $ExpectError
|
|
76
|
-
stridedarray2iterator( 2, [ 1, 2, 3, 4 ], -2, {} ); // $ExpectError
|
|
77
|
-
stridedarray2iterator( 2, [ 1, 2, 3, 4 ], -2, null ); // $ExpectError
|
|
78
|
-
stridedarray2iterator( 2, [ 1, 2, 3, 4 ], -2, undefined ); // $ExpectError
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
// The compiler throws an error if the function is provided a fifth argument which is not a map function...
|
|
82
|
-
{
|
|
83
|
-
stridedarray2iterator( 2, [ 1, 2, 3, 4 ], -2, 3, 'abc' ); // $ExpectError
|
|
84
|
-
stridedarray2iterator( 2, [ 1, 2, 3, 4 ], -2, 3, 123 ); // $ExpectError
|
|
85
|
-
stridedarray2iterator( 2, [ 1, 2, 3, 4 ], -2, 3, [] ); // $ExpectError
|
|
86
|
-
stridedarray2iterator( 2, [ 1, 2, 3, 4 ], -2, 3, {} ); // $ExpectError
|
|
87
|
-
stridedarray2iterator( 2, [ 1, 2, 3, 4 ], -2, 3, true ); // $ExpectError
|
|
88
|
-
stridedarray2iterator( 2, [ 1, 2, 3, 4 ], -2, 3, false ); // $ExpectError
|
|
89
|
-
stridedarray2iterator( 2, [ 1, 2, 3, 4 ], -2, 3, null ); // $ExpectError
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
// The compiler throws an error if the function is provided an unsupported number of arguments...
|
|
93
|
-
{
|
|
94
|
-
stridedarray2iterator(); // $ExpectError
|
|
95
|
-
stridedarray2iterator( 2 ); // $ExpectError
|
|
96
|
-
stridedarray2iterator( 2, [ 1, 2, 3, 4 ] ); // $ExpectError
|
|
97
|
-
stridedarray2iterator( 2, [ 1, 2, 3, 4 ], -2 ); // $ExpectError
|
|
98
|
-
stridedarray2iterator( 2, [ 1, 2, 3, 4 ], -2, 3, times10, {}, 123 ); // $ExpectError
|
|
99
|
-
}
|