2.1.2 • Published 1 year ago
the-lodash v2.1.2
Lodash Extender
Library meant to extend capabilites of NodeJS Lodash library.
_.makeDict
Create a dictionary object from array.
Signature:
_.makeDict(array, cbKey, cbValue) : returns dict.
array: array of items
cbKey: function to return key of each item.
cbValue: optional callback to set value for each item. if not set the value would be the item itself.
Usage 1:
var items = ['cat', 'dog', 'elephant']
var dict = _.makeDict(items, x => x, x => x.length);
console.log(dict);
Outputs:
{
"cat": 3,
"dog": 3,
"elephant": 8,
}
Usage 2:
var items = [
{ id: 1, name: 'cat' },
{ id: 3, name: 'dog' },
{ id: 4, name: 'elephant' }
]
var dict = _.makeDict(items, x => x.id, x => ({ name: x.name }));
console.log(dict);
Outputs:
{
1: {
"name": "cat"
},
3: {
"name": "dog"
},
4: {
"name", "elephant"
}
}
Publishing
$ ./publish.sh
Updating NPM Key
$ travis encrypt <NPM-KEY-GOES-HERE> --add deploy.api_key
2.1.2
1 year ago
2.1.1
1 year ago
2.1.0
1 year ago
2.0.11
1 year ago
2.0.12
1 year ago
2.0.10
1 year ago
2.0.9
3 years ago
2.0.8
3 years ago
2.0.7
3 years ago
2.0.6
3 years ago
2.0.5
3 years ago
2.0.4
3 years ago
2.0.2
3 years ago
2.0.1
3 years ago
1.2.2
4 years ago
2.0.0
4 years ago
1.2.1
4 years ago
1.1.1
4 years ago
1.0.15
5 years ago
1.0.14
5 years ago
1.0.13
6 years ago
1.0.12
6 years ago
1.0.11
6 years ago
1.0.10
6 years ago
1.0.9
6 years ago
1.0.7
6 years ago
1.0.6
6 years ago
1.0.5
6 years ago
1.0.4
6 years ago
1.0.3
6 years ago
1.0.2
6 years ago
1.0.1
6 years ago
1.0.0
6 years ago