@stdlib/utils-map 0.0.1 → 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 +46 -16
- package/SECURITY.md +5 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +11 -0
- package/dist/index.js.map +7 -0
- package/docs/types/index.d.ts +34 -34
- package/lib/array.js +6 -6
- package/lib/assign.js +5 -4
- package/lib/main.js +3 -2
- package/lib/ndarray.js +6 -6
- package/package.json +35 -32
- package/docs/repl.txt +0 -106
- package/docs/types/test.ts +0 -270
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
|
# map
|
|
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] -->
|
|
@@ -231,7 +242,7 @@ The applied function is provided the same arguments as with [`map`](#fcn-map).
|
|
|
231
242
|
// returns 20.0
|
|
232
243
|
```
|
|
233
244
|
|
|
234
|
-
- When applying a function to [`ndarray`][@stdlib/ndarray/ctor]-like objects, performance will be best for [`ndarray`][@stdlib/ndarray/ctor]-like objects which are single-segment contiguous. For non-contiguous arrays, see [`@stdlib/ndarray
|
|
245
|
+
- When applying a function to [`ndarray`][@stdlib/ndarray/ctor]-like objects, performance will be best for [`ndarray`][@stdlib/ndarray/ctor]-like objects which are single-segment contiguous. For non-contiguous arrays, see [`@stdlib/ndarray-base/unary`][@stdlib/ndarray/base/unary].
|
|
235
246
|
|
|
236
247
|
- Both [`map`](#fcn-map) and [`map.assign`](#method-map-assign) do **not** skip `undefined` elements.
|
|
237
248
|
|
|
@@ -295,6 +306,13 @@ console.log( y.data );
|
|
|
295
306
|
|
|
296
307
|
<section class="related">
|
|
297
308
|
|
|
309
|
+
* * *
|
|
310
|
+
|
|
311
|
+
## See Also
|
|
312
|
+
|
|
313
|
+
- <span class="package-name">[`@stdlib/utils-map-right`][@stdlib/utils/map-right]</span><span class="delimiter">: </span><span class="description">apply a function to each element in an array and assign the result to an element in an output array, iterating from right to left.</span>
|
|
314
|
+
- <span class="package-name">[`@stdlib/utils-reduce`][@stdlib/utils/reduce]</span><span class="delimiter">: </span><span class="description">apply a function against an accumulator and each element in an array and return the accumulated result.</span>
|
|
315
|
+
|
|
298
316
|
</section>
|
|
299
317
|
|
|
300
318
|
<!-- /.related -->
|
|
@@ -325,7 +343,7 @@ See [LICENSE][stdlib-license].
|
|
|
325
343
|
|
|
326
344
|
## Copyright
|
|
327
345
|
|
|
328
|
-
Copyright © 2016-
|
|
346
|
+
Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors].
|
|
329
347
|
|
|
330
348
|
</section>
|
|
331
349
|
|
|
@@ -338,8 +356,8 @@ Copyright © 2016-2022. The Stdlib [Authors][stdlib-authors].
|
|
|
338
356
|
[npm-image]: http://img.shields.io/npm/v/@stdlib/utils-map.svg
|
|
339
357
|
[npm-url]: https://npmjs.org/package/@stdlib/utils-map
|
|
340
358
|
|
|
341
|
-
[test-image]: https://github.com/stdlib-js/utils-map/actions/workflows/test.yml/badge.svg
|
|
342
|
-
[test-url]: https://github.com/stdlib-js/utils-map/actions/workflows/test.yml
|
|
359
|
+
[test-image]: https://github.com/stdlib-js/utils-map/actions/workflows/test.yml/badge.svg?branch=v0.2.0
|
|
360
|
+
[test-url]: https://github.com/stdlib-js/utils-map/actions/workflows/test.yml?query=branch:v0.2.0
|
|
343
361
|
|
|
344
362
|
[coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/utils-map/main.svg
|
|
345
363
|
[coverage-url]: https://codecov.io/github/stdlib-js/utils-map?branch=main
|
|
@@ -351,35 +369,47 @@ Copyright © 2016-2022. The Stdlib [Authors][stdlib-authors].
|
|
|
351
369
|
|
|
352
370
|
-->
|
|
353
371
|
|
|
372
|
+
[chat-image]: https://img.shields.io/gitter/room/stdlib-js/stdlib.svg
|
|
373
|
+
[chat-url]: https://app.gitter.im/#/room/#stdlib-js_stdlib:gitter.im
|
|
374
|
+
|
|
375
|
+
[stdlib]: https://github.com/stdlib-js/stdlib
|
|
376
|
+
|
|
377
|
+
[stdlib-authors]: https://github.com/stdlib-js/stdlib/graphs/contributors
|
|
378
|
+
|
|
354
379
|
[umd]: https://github.com/umdjs/umd
|
|
355
380
|
[es-module]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules
|
|
356
381
|
|
|
357
382
|
[deno-url]: https://github.com/stdlib-js/utils-map/tree/deno
|
|
383
|
+
[deno-readme]: https://github.com/stdlib-js/utils-map/blob/deno/README.md
|
|
358
384
|
[umd-url]: https://github.com/stdlib-js/utils-map/tree/umd
|
|
385
|
+
[umd-readme]: https://github.com/stdlib-js/utils-map/blob/umd/README.md
|
|
359
386
|
[esm-url]: https://github.com/stdlib-js/utils-map/tree/esm
|
|
387
|
+
[esm-readme]: https://github.com/stdlib-js/utils-map/blob/esm/README.md
|
|
388
|
+
[branches-url]: https://github.com/stdlib-js/utils-map/blob/main/branches.md
|
|
360
389
|
|
|
361
|
-
[
|
|
362
|
-
[chat-url]: https://gitter.im/stdlib-js/stdlib/
|
|
390
|
+
[stdlib-license]: https://raw.githubusercontent.com/stdlib-js/utils-map/main/LICENSE
|
|
363
391
|
|
|
364
|
-
[stdlib]: https://
|
|
392
|
+
[@stdlib/ndarray/ctor]: https://www.npmjs.com/package/@stdlib/ndarray-ctor
|
|
365
393
|
|
|
366
|
-
[stdlib
|
|
394
|
+
[@stdlib/ndarray/base/unary]: https://www.npmjs.com/package/@stdlib/ndarray-base-unary
|
|
367
395
|
|
|
368
|
-
[stdlib-
|
|
396
|
+
[@stdlib/ndarray/base/broadcast-shapes]: https://www.npmjs.com/package/@stdlib/ndarray-base-broadcast-shapes
|
|
369
397
|
|
|
370
|
-
[@stdlib/ndarray/
|
|
398
|
+
[@stdlib/ndarray/base/assert/is-contiguous]: https://www.npmjs.com/package/@stdlib/ndarray-base-assert-is-contiguous
|
|
371
399
|
|
|
372
|
-
[@stdlib/
|
|
400
|
+
[@stdlib/array/complex64]: https://www.npmjs.com/package/@stdlib/array-complex64
|
|
373
401
|
|
|
374
|
-
[@stdlib/
|
|
402
|
+
[@stdlib/array/complex128]: https://www.npmjs.com/package/@stdlib/array-complex128
|
|
375
403
|
|
|
376
|
-
[
|
|
404
|
+
[mdn-typedarray-map]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/map
|
|
377
405
|
|
|
378
|
-
|
|
406
|
+
<!-- <related-links> -->
|
|
379
407
|
|
|
380
|
-
[@stdlib/
|
|
408
|
+
[@stdlib/utils/map-right]: https://www.npmjs.com/package/@stdlib/utils-map-right
|
|
381
409
|
|
|
382
|
-
[
|
|
410
|
+
[@stdlib/utils/reduce]: https://www.npmjs.com/package/@stdlib/utils-reduce
|
|
411
|
+
|
|
412
|
+
<!-- </related-links> -->
|
|
383
413
|
|
|
384
414
|
</section>
|
|
385
415
|
|
package/SECURITY.md
ADDED
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";var d=function(r,e){return function(){return e||r((e={exports:{}}).exports,e),e.exports}};var b=d(function(sr,O){
|
|
2
|
+
var T=require('@stdlib/ndarray-base-vind2bind/dist'),V="throw";function J(r,e,i,a){var t,n,v,o,s,y,c,m,f,w,k,j,h,p,E,F,u;if(s=r.length,f=r.shape,w=e.shape,t=r.data,n=e.data,k=r.strides,j=e.strides,h=r.offset,p=e.offset,v=r.order,o=e.order,y=r.accessors[0],c=e.accessors[1],m=r.ref,f.length===0){c(n,p,i.call(a,y(t,h),0,m));return}for(u=0;u<s;u++)E=T(f,k,h,v,u,V),F=T(w,j,p,o,u,V),c(n,F,i.call(a,y(t,E),u,m))}O.exports=J
|
|
3
|
+
});var q=d(function(ur,x){
|
|
4
|
+
function K(r,e,i,a){var t,n,v,o,s;for(t=r.data,n=e.data,v=r.accessors[0],o=e.accessors[1],s=0;s<t.length;s++)o(n,s,i.call(a,v(t,s),s,t))}x.exports=K
|
|
5
|
+
});var C=d(function(vr,z){
|
|
6
|
+
var N=require('@stdlib/assert-is-array-like-object/dist'),P=require('@stdlib/assert-is-ndarray-like/dist'),Q=require('@stdlib/assert-is-function/dist'),U=require('@stdlib/array-base-zeros/dist'),L=require('@stdlib/ndarray-base-ndarraylike2object/dist'),I=require('@stdlib/array-base-arraylike2object/dist'),W=require('@stdlib/ndarray-zeros/dist'),R=require('@stdlib/error-tools-fmtprodmsg/dist'),X=b(),Y=q();function Z(r,e,i){var a;if(!Q(e))throw new TypeError(R('1VT2H',e));if(P(r))return r=L(r),a=W(r.shape,{dtype:"generic",order:r.order}),X(r,L(a),e,i),a;if(N(r))return a=U(r.length),Y(I(r),I(a),e,i),a;throw new TypeError(R('1VTBH',r))}z.exports=Z
|
|
7
|
+
});var G=d(function(or,B){
|
|
8
|
+
var D=require('@stdlib/assert-is-array-like-object/dist'),g=require('@stdlib/assert-is-ndarray-like/dist'),_=require('@stdlib/assert-is-function/dist'),M=require('@stdlib/ndarray-base-ndarraylike2object/dist'),S=require('@stdlib/array-base-arraylike2object/dist'),$=require('@stdlib/ndarray-base-maybe-broadcast-array/dist'),A=require('@stdlib/ndarray-base-assert-is-read-only/dist'),l=require('@stdlib/error-tools-fmtprodmsg/dist'),rr=b(),er=q();function ar(r,e,i,a){var t,n;if(!_(i))throw new TypeError(l('1VT3N',i));if(g(r)){if(!g(e))throw new TypeError(l('1VTBF',e));if(A(e))throw new Error(l('1VT1g'));return e=M(e),n=e.shape,t=M($(r,n)),t.ref=r,r=t,rr(r,e,i,a),e.ref}if(D(r)){if(!D(e)||g(e))throw new TypeError(l('1VTBG',e));if(r.length!==e.length)throw new RangeError(l('1VT1h'));return er(S(r),S(e),i,a),e}throw new TypeError(l('1VTBH',r))}B.exports=ar
|
|
9
|
+
});var ir=require('@stdlib/utils-define-nonenumerable-read-only-property/dist'),H=C(),tr=G();ir(H,"assign",tr);module.exports=H;
|
|
10
|
+
/** @license Apache-2.0 */
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../lib/ndarray.js", "../lib/array.js", "../lib/main.js", "../lib/assign.js", "../lib/index.js"],
|
|
4
|
+
"sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 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 vind2bind = require( '@stdlib/ndarray-base-vind2bind' );\n\n\n// VARIABLES //\n\nvar MODE = 'throw';\n\n\n// MAIN //\n\n/**\n* Applies a function to each element in an ndarray and assigns the result to an element in an output ndarray.\n*\n* @private\n* @param {Object} x - object containing input ndarray meta data\n* @param {string} x.ref - reference to original input ndarray-like object\n* @param {string} x.dtype - data type\n* @param {Collection} x.data - data buffer\n* @param {NonNegativeInteger} x.length - number of elements\n* @param {NonNegativeIntegerArray} x.shape - dimensions\n* @param {IntegerArray} x.strides - stride lengths\n* @param {NonNegativeInteger} x.offset - index offset\n* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style)\n* @param {Array<Function>} x.accessors - accessors for accessing data buffer elements\n* @param {Object} y - object containing output ndarray meta data\n* @param {string} y.dtype - data type\n* @param {Collection} y.data - data buffer\n* @param {NonNegativeInteger} y.length - number of elements\n* @param {NonNegativeIntegerArray} y.shape - dimensions\n* @param {IntegerArray} y.strides - stride lengths\n* @param {NonNegativeInteger} y.offset - index offset\n* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style)\n* @param {Array<Function>} y.accessors - accessors for accessing data buffer elements\n* @param {Function} fcn - function to apply\n* @param {*} thisArg - function execution context\n* @returns {void}\n*\n* @example\n* var Complex64Array = require( '@stdlib/array-complex64' );\n* var Complex64 = require( '@stdlib/complex-float32' );\n* var realf = require( '@stdlib/complex-realf' );\n* var imagf = require( '@stdlib/complex-imagf' );\n* var naryFunction = require( '@stdlib/utils-nary-function' );\n*\n* function scale( z ) {\n* return new Complex64( realf(z)*10.0, imagf(z)*10.0 );\n* }\n*\n* // Create data buffers:\n* var xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );\n* var ybuf = new Complex64Array( 4 );\n*\n* // Define the shape of the input and output arrays:\n* var shape = [ 2, 2 ];\n*\n* // Define the array strides:\n* var sx = [ 2, 1 ];\n* var sy = [ 2, 1 ];\n*\n* // Define the index offsets:\n* var ox = 0;\n* var oy = 0;\n*\n* // Define getters and setters:\n* function getter( buf, idx ) {\n* return buf.get( idx );\n* }\n*\n* function setter( buf, idx, value ) {\n* buf.set( value, idx );\n* }\n*\n* // Create the input and output ndarray-like objects:\n* var x = {\n* 'ref': null,\n* 'dtype': 'complex64',\n* 'data': xbuf,\n* 'length': 4,\n* 'shape': shape,\n* 'strides': sx,\n* 'offset': ox,\n* 'order': 'row-major',\n* 'accessors': [ getter, setter ]\n* };\n* x.ref = x;\n*\n* var y = {\n* 'ref': null,\n* 'dtype': 'complex64',\n* 'data': ybuf,\n* 'length': 4,\n* 'shape': shape,\n* 'strides': sy,\n* 'offset': oy,\n* 'order': 'row-major',\n* 'accessors': [ getter, setter ]\n* };\n*\n* // Apply the unary function:\n* map( x, y, naryFunction( scale, 1 ) );\n*\n* var v = y.data.get( 0 );\n*\n* var re = realf( v );\n* // returns 10.0\n*\n* var im = imagf( v );\n* // returns 20.0\n*/\nfunction map( x, y, fcn, thisArg ) {\n\tvar xbuf;\n\tvar ybuf;\n\tvar ordx;\n\tvar ordy;\n\tvar len;\n\tvar get;\n\tvar set;\n\tvar ref;\n\tvar shx;\n\tvar shy;\n\tvar sx;\n\tvar sy;\n\tvar ox;\n\tvar oy;\n\tvar ix;\n\tvar iy;\n\tvar i;\n\n\t// Cache the total number of elements over which to iterate:\n\tlen = x.length;\n\n\t// Cache the input array shape:\n\tshx = x.shape;\n\tshy = y.shape;\n\n\t// Cache references to the input and output ndarray data buffers:\n\txbuf = x.data;\n\tybuf = y.data;\n\n\t// Cache references to the respective stride arrays:\n\tsx = x.strides;\n\tsy = y.strides;\n\n\t// Cache the indices of the first indexed elements in the respective ndarrays:\n\tox = x.offset;\n\toy = y.offset;\n\n\t// Cache the respective array orders:\n\tordx = x.order;\n\tordy = y.order;\n\n\t// Cache accessors:\n\tget = x.accessors[ 0 ];\n\tset = y.accessors[ 1 ];\n\n\t// Cache the reference to the original input array:\n\tref = x.ref;\n\n\t// Check for a zero-dimensional array...\n\tif ( shx.length === 0 ) {\n\t\tset( ybuf, oy, fcn.call( thisArg, get( xbuf, ox ), 0, ref ) );\n\t\treturn;\n\t}\n\t// Iterate over each element based on the linear **view** index, regardless as to how the data is stored in memory (note: this has negative performance implications for non-contiguous ndarrays due to a lack of data locality)...\n\tfor ( i = 0; i < len; i++ ) {\n\t\tix = vind2bind( shx, sx, ox, ordx, i, MODE );\n\t\tiy = vind2bind( shy, sy, oy, ordy, i, MODE );\n\t\tset( ybuf, iy, fcn.call( thisArg, get( xbuf, ix ), i, ref ) );\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = map;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 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// MAIN //\n\n/**\n* Applies a function to each element in an array and assigns the result to an element in an output array.\n*\n* @private\n* @param {Object} x - object containing input array data\n* @param {ArrayLikeObject} x.data - input array data\n* @param {Array<Function>} x.accessors - input array accessors\n* @param {Object} y - object containing output array data\n* @param {ArrayLikeObject} y.data - output array data\n* @param {Array<Function>} y.accessors - output array accessors\n* @param {Function} fcn - function to apply\n* @param {*} thisArg - function execution context\n* @returns {void}\n*\n* @example\n* var naryFunction = require( '@stdlib/utils-nary-function' );\n* var abs = require( '@stdlib/math-base-special-abs' );\n*\n* // Define getters and setters:\n* function getter( buf, idx ) {\n* return buf[ idx ];\n* }\n*\n* function setter( buf, idx, value ) {\n* buf[ idx ] = value;\n* }\n*\n* // Create the input and output array objects:\n* var x = {\n* 'data': [ -1, -2, -3, -4, -5, -6 ],\n* 'accessors': [ getter, setter ]\n* };\n* var y = {\n* 'data': [ 0, 0, 0, 0, 0, 0 ],\n* 'accessors': [ getter, setter ]\n* };\n*\n* map( x, y, naryFunction( abs, 1 ) );\n*\n* var data = y.data;\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*/\nfunction map( x, y, fcn, thisArg ) {\n\tvar xbuf;\n\tvar ybuf;\n\tvar get;\n\tvar set;\n\tvar i;\n\n\t// Cache references to the input and output data:\n\txbuf = x.data;\n\tybuf = y.data;\n\n\t// Cache accessors:\n\tget = x.accessors[ 0 ];\n\tset = y.accessors[ 1 ];\n\n\t// Iterate over each element...\n\tfor ( i = 0; i < xbuf.length; i++ ) {\n\t\tset( ybuf, i, fcn.call( thisArg, get( xbuf, i ), i, xbuf ) );\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = map;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 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 isArrayLikeObject = require( '@stdlib/assert-is-array-like-object' );\nvar isndarrayLike = require( '@stdlib/assert-is-ndarray-like' );\nvar isFunction = require( '@stdlib/assert-is-function' );\nvar zeros = require( '@stdlib/array-base-zeros' );\nvar ndarraylike2object = require( '@stdlib/ndarray-base-ndarraylike2object' );\nvar arraylike2object = require( '@stdlib/array-base-arraylike2object' );\nvar ndzeros = require( '@stdlib/ndarray-zeros' );\nvar format = require( '@stdlib/string-format' );\nvar ndarrayFcn = require( './ndarray.js' );\nvar arrayFcn = require( './array.js' );\n\n\n// MAIN //\n\n/**\n* Applies a function to each element in an array and assigns the result to an element in a new array.\n*\n* ## Notes\n*\n* - The applied function is provided the following arguments:\n*\n* - **value**: array element.\n* - **index**: element index.\n* - **arr**: input array.\n*\n* @param {(ArrayLikeObject|ndarray)} arr - input array\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @throws {TypeError} first argument must be an array-like object or an ndarray\n* @throws {TypeError} second argument must be a function\n* @returns {(Array|ndarray)} output array\n*\n* @example\n* var naryFunction = require( '@stdlib/utils-nary-function' );\n* var abs = require( '@stdlib/math-base-special-abs' );\n*\n* var arr = [ -1, -2, -3, -4, -5, -6 ];\n*\n* var out = map( arr, naryFunction( abs, 1 ) );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* var naryFunction = require( '@stdlib/utils-nary-function' );\n* var abs = require( '@stdlib/math-base-special-abs' );\n* var array = require( '@stdlib/ndarray-array' );\n*\n* var opts = {\n* 'dtype': 'generic'\n* };\n* var arr = array( [ [ -1, -2, -3 ], [ -4, -5, -6 ] ], opts );\n*\n* var out = map( arr, naryFunction( abs, 1 ) );\n* // returns <ndarray>\n*\n* var data = out.data;\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*/\nfunction map( arr, fcn, thisArg ) {\n\tvar out;\n\tif ( !isFunction( fcn ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a function. Value: `%s`.', fcn ) );\n\t}\n\tif ( isndarrayLike( arr ) ) { // note: assertion order matters here, as an ndarray-like object is also array-like\n\t\tarr = ndarraylike2object( arr );\n\t\tout = ndzeros( arr.shape, {\n\t\t\t'dtype': 'generic',\n\t\t\t'order': arr.order\n\t\t});\n\t\tndarrayFcn( arr, ndarraylike2object( out ), fcn, thisArg );\n\t\treturn out;\n\t}\n\tif ( isArrayLikeObject( arr ) ) {\n\t\tout = zeros( arr.length );\n\t\tarrayFcn( arraylike2object( arr ), arraylike2object( out ), fcn, thisArg ); // eslint-disable-line max-len\n\t\treturn out;\n\t}\n\tthrow new TypeError( format( 'invalid argument. First argument must be an array-like object or an ndarray. Value: `%s`.', arr ) );\n}\n\n\n// EXPORTS //\n\nmodule.exports = map;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 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 isArrayLikeObject = require( '@stdlib/assert-is-array-like-object' );\nvar isndarrayLike = require( '@stdlib/assert-is-ndarray-like' );\nvar isFunction = require( '@stdlib/assert-is-function' );\nvar ndarraylike2object = require( '@stdlib/ndarray-base-ndarraylike2object' );\nvar arraylike2object = require( '@stdlib/array-base-arraylike2object' );\nvar broadcast = require( '@stdlib/ndarray-base-maybe-broadcast-array' );\nvar isReadOnly = require( '@stdlib/ndarray-base-assert-is-read-only' );\nvar format = require( '@stdlib/string-format' );\nvar ndarrayFcn = require( './ndarray.js' );\nvar arrayFcn = require( './array.js' );\n\n\n// MAIN //\n\n/**\n* Applies a function to each element in an array and assigns the result to an element in an output array.\n*\n* ## Notes\n*\n* - The applied function is provided the following arguments:\n*\n* - **value**: array element.\n* - **index**: element index.\n* - **arr**: input array.\n*\n* @param {(ArrayLikeObject|ndarray)} arr - input array\n* @param {(ArrayLikeObject|ndarray)} out - output array\n* @param {Function} fcn - function to apply\n* @param {*} [thisArg] - function execution context\n* @throws {TypeError} first argument must be an array-like object or an ndarray\n* @throws {TypeError} second argument must be an array-like object or an ndarray\n* @throws {TypeError} third argument must be a function\n* @throws {TypeError} input and output arrays must be either both array-like objects or both ndarrays\n* @throws {RangeError} input and output arrays must have the same length\n* @throws {Error} input and output ndarrays must be broadcast compatible\n* @throws {Error} cannot write to a read-only ndarray\n* @returns {(ArrayLikeObject|ndarray)} output array\n*\n* @example\n* var naryFunction = require( '@stdlib/utils-nary-function' );\n* var abs = require( '@stdlib/math-base-special-abs' );\n*\n* var arr = [ -1, -2, -3, -4, -5, -6 ];\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* map( arr, out, naryFunction( abs, 1 ) );\n*\n* console.log( out );\n* // => [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* var naryFunction = require( '@stdlib/utils-nary-function' );\n* var abs = require( '@stdlib/math-base-special-abs' );\n* var array = require( '@stdlib/ndarray-array' );\n*\n* var opts = {\n* 'dtype': 'generic',\n* 'shape': [ 2, 3 ]\n* };\n* var arr = array( [ [ -1, -2, -3 ], [ -4, -5, -6 ] ], opts );\n* var out = array( opts );\n*\n* map( arr, out, naryFunction( abs, 1 ) );\n*\n* var data = out.data;\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*/\nfunction map( arr, out, fcn, thisArg ) {\n\tvar tmp;\n\tvar sh;\n\tif ( !isFunction( fcn ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Third argument must be a function. Value: `%s`.', fcn ) );\n\t}\n\tif ( isndarrayLike( arr ) ) { // note: assertion order matters here, as an ndarray-like object is also array-like\n\t\tif ( !isndarrayLike( out ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. If the input array is an ndarray, the output array must also be an ndarray. Value: `%s`.', out ) );\n\t\t}\n\t\tif ( isReadOnly( out ) ) {\n\t\t\tthrow new Error( 'invalid argument. The output ndarray must be writable. Cannot write to a read-only ndarray.' );\n\t\t}\n\t\tout = ndarraylike2object( out );\n\t\tsh = out.shape;\n\n\t\ttmp = ndarraylike2object( broadcast( arr, sh ) );\n\t\ttmp.ref = arr;\n\t\tarr = tmp;\n\n\t\tndarrayFcn( arr, out, fcn, thisArg );\n\t\treturn out.ref;\n\t}\n\tif ( isArrayLikeObject( arr ) ) {\n\t\tif ( !isArrayLikeObject( out ) || isndarrayLike( out ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. If the input array is an array-like object, the output array must also be an array-like object. Value: `%s`.', out ) );\n\t\t}\n\t\tif ( arr.length !== out.length ) {\n\t\t\tthrow new RangeError( 'invalid arguments. Input and output arrays must have the same length.' );\n\t\t}\n\t\tarrayFcn( arraylike2object( arr ), arraylike2object( out ), fcn, thisArg ); // eslint-disable-line max-len\n\t\treturn out;\n\t}\n\tthrow new TypeError( format( 'invalid argument. First argument must be an array-like object or an ndarray. Value: `%s`.', arr ) );\n}\n\n\n// EXPORTS //\n\nmodule.exports = map;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 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* Apply a function to each element in an array and assign the result to an element in an output array.\n*\n* @module @stdlib/utils-map\n*\n* @example\n* var naryFunction = require( '@stdlib/utils-nary-function' );\n* var abs = require( '@stdlib/math-base-special-abs' );\n* var map = require( '@stdlib/utils-map' );\n*\n* var arr = [ -1, -2, -3, -4, -5, -6 ];\n*\n* var out = map( arr, naryFunction( abs, 1 ) );\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* var naryFunction = require( '@stdlib/utils-nary-function' );\n* var abs = require( '@stdlib/math-base-special-abs' );\n* var array = require( '@stdlib/ndarray-array' );\n* var map = require( '@stdlib/utils-map' );\n*\n* var opts = {\n* 'dtype': 'generic'\n* };\n* var arr = array( [ [ -1, -2, -3 ], [ -4, -5, -6 ] ], opts );\n*\n* var out = map( arr, naryFunction( abs, 1 ) );\n* // returns <ndarray>\n*\n* var data = out.data;\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* var naryFunction = require( '@stdlib/utils-nary-function' );\n* var abs = require( '@stdlib/math-base-special-abs' );\n* var map = require( '@stdlib/utils-map' );\n*\n* var arr = [ -1, -2, -3, -4, -5, -6 ];\n* var out = [ 0, 0, 0, 0, 0, 0 ];\n*\n* map.assign( arr, out, naryFunction( abs, 1 ) );\n*\n* console.log( out );\n* // => [ 1, 2, 3, 4, 5, 6 ]\n*\n* @example\n* var naryFunction = require( '@stdlib/utils-nary-function' );\n* var abs = require( '@stdlib/math-base-special-abs' );\n* var array = require( '@stdlib/ndarray-array' );\n* var map = require( '@stdlib/utils-map' );\n*\n* var opts = {\n* 'dtype': 'generic',\n* 'shape': [ 2, 3 ]\n* };\n* var arr = array( [ [ -1, -2, -3 ], [ -4, -5, -6 ] ], opts );\n* var out = array( opts );\n*\n* map.assign( arr, out, naryFunction( abs, 1 ) );\n*\n* var data = out.data;\n* // returns [ 1, 2, 3, 4, 5, 6 ]\n*/\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar main = require( './main.js' );\nvar assign = require( './assign.js' );\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": ["require_ndarray", "__commonJSMin", "exports", "module", "vind2bind", "MODE", "map", "x", "y", "fcn", "thisArg", "xbuf", "ybuf", "ordx", "ordy", "len", "get", "set", "ref", "shx", "shy", "sx", "sy", "ox", "oy", "ix", "iy", "i", "require_array", "__commonJSMin", "exports", "module", "map", "x", "y", "fcn", "thisArg", "xbuf", "ybuf", "get", "set", "i", "require_main", "__commonJSMin", "exports", "module", "isArrayLikeObject", "isndarrayLike", "isFunction", "zeros", "ndarraylike2object", "arraylike2object", "ndzeros", "format", "ndarrayFcn", "arrayFcn", "map", "arr", "fcn", "thisArg", "out", "require_assign", "__commonJSMin", "exports", "module", "isArrayLikeObject", "isndarrayLike", "isFunction", "ndarraylike2object", "arraylike2object", "broadcast", "isReadOnly", "format", "ndarrayFcn", "arrayFcn", "map", "arr", "out", "fcn", "thisArg", "tmp", "sh", "setReadOnly", "main", "assign"]
|
|
7
|
+
}
|