Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jonkemp/map-plus
A better map
https://github.com/jonkemp/map-plus
array arrays map object util utility
Last synced: 26 days ago
JSON representation
A better map
- Host: GitHub
- URL: https://github.com/jonkemp/map-plus
- Owner: jonkemp
- License: mit
- Created: 2020-03-21T03:21:07.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2022-03-24T03:24:52.000Z (over 2 years ago)
- Last Synced: 2024-04-26T23:03:02.129Z (6 months ago)
- Topics: array, arrays, map, object, util, utility
- Language: JavaScript
- Homepage:
- Size: 210 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# map-plus ![Build Status](https://github.com/jonkemp/map-plus/actions/workflows/main.yml/badge.svg?branch=master)
> Produces a new array of values by mapping each value in list through a transformation function (iteratee).
The iteratee is passed three arguments: the `value`, then the index (or `key`) of the iteration, and finally a reference to the entire `list`.
Inspired by `_.map`. 😄
## Install
Install with [npm](https://npmjs.org/package/map-plus)
```
$ npm install map-plus
```Or [unpkg](https://unpkg.com/map-plus/)
```
```
Check out the unit tests on [CodePen](https://codepen.io/jonkemp/full/bGdjJVw).
## Usage
```js
const map = require('map-plus');map([1, 2, 3], num => num * 3);
//=> [3, 6, 9]map({one: 1, two: 2, three: 3}, (num, key) => num * 3);
//=> [3, 6, 9]
```---
| **Like us a lot?** Help others know why you like us! **Review this package on [pkgreview.dev](https://pkgreview.dev/npm/map-plus)** | âž¡ | [![Review us on pkgreview.dev](https://i.ibb.co/McjVMfb/pkgreview-dev.jpg)](https://pkgreview.dev/npm/map-plus) |
| ----------------------------------------------------------------------------------------------------------------------------------------- | --- | --------------------------------------------------------------------------------------------------------------------- |## API
### map(list, iteratee, [context])
#### list
Type: `array` or `object`
Default: `none`The collection of elements to iterate over.
#### iteratee
Type: `function` or `string`
Default: `none`Function to apply. Or property name to pass.
## License
MIT