@extra-array/map-update
Version:
Updates values based on map function.
54 lines (40 loc) • 1.66 kB
Markdown
Updates values based on map function.
[:package:](https://www.npmjs.com/package/@extra-array/map-update)
[:smiley_cat:](https://github.com/orgs/nodef/packages?repo_name=extra-array)
[:running:](https://npm.runkit.com/@extra-array/map-update)
[:vhs:](https://asciinema.org/a/332093)
[:moon:](https://www.npmjs.com/package/@extra-array/map-update.min)
[:scroll:](https://unpkg.com/@extra-array/map-update/)
[: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 (updated)
// fm: map function (v, i, x)
// → x
```
```javascript
const array = require("extra-array");
var x = [1, 2, 3, 4];
array.map$(x, v => v * 2);
// [ 2, 4, 6, 8 ]
x;
// [ 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)
[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