@extra-array/map
Version:
Updates values based on map function.
52 lines (39 loc) • 1.73 kB
Markdown
Updates values based on map function.
[:package:](https://www.npmjs.com/package/@extra-array/map)
[:smiley_cat:](https://github.com/orgs/nodef/packages?repo_name=extra-array)
[:running:](https://npm.runkit.com/@extra-array/map)
[:vhs:](https://asciinema.org/a/332094)
[:moon:](https://www.npmjs.com/package/@extra-array/map.min)
[:scroll:](https://unpkg.com/@extra-array/map/)
[:newspaper:](https://nodef.github.io/extra-array/)
[:blue_book:](https://github.com/nodef/extra-array/wiki/)
> Alternatives: [map], [map$].<br>
> Similar: [map], [filter], [reject], [reduce], [accumulate].
> This is part of package [extra-array].
[extra-array]: https://www.npmjs.com/package/extra-array
<br>
```javascript
array.map(x, fm);
// x: an array
// fm: map function (v, i, x)
```
```javascript
const array = require("extra-array");
var x = [1, 2, 3, 4];
array.map(x, v => v * 2);
// [ 2, 4, 6, 8 ]
```
<br>
<br>
## References
- [Data.List.map: Haskell](https://hackage.haskell.org/package/base-4.12.0.0/docs/Data-List.html#v:map)
- [Array.prototype.map: MDN web docs](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map)
- [array_map: PHP](https://www.php.net/manual/en/function.array-map.php)
- [Array.map: sugarjs](https://sugarjs.com/docs/#/Array/map)
- [filter-collection: @dimd13](https://www.npmjs.com/package/filter-collection)
[map]: https://github.com/nodef/extra-array/wiki/map
[map$]: https://github.com/nodef/extra-array/wiki/map$
[filter]: https://github.com/nodef/extra-array/wiki/filter
[reduce]: https://github.com/nodef/extra-array/wiki/reduce
[accumulate]: https://github.com/nodef/extra-array/wiki/accumulate
[reject]: https://github.com/nodef/extra-array/wiki/reject