You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

aggregate-array-extensions

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

aggregate-array-extensions - npm Package Compare versions

Comparing version

to
0.0.5

map.js

2

package.json
{
"name": "aggregate-array-extensions",
"version": "0.0.4",
"version": "0.0.5",
"description": "Simple extensions to the Array prototype for aggregating elements",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -103,1 +103,23 @@ # aggregate-array-extensions

```
## mapIntoObject
Array.prototype.mapIntoObject = function(keySelector, valueSelector)
Parameter|Description
-|-
keySelector|Function to select the key on the result object
valueSelector|Function to select the value to assign
```Javascript
expect([
{ v: 1 },
{ v: 2 },
{ v: 3 }
].mapIntoObject(x => x.v, x => x.v * 2))
.toEqual({
1: 2,
2: 4,
3: 6
})
```