Comparing version 0.4.0 to 0.4.1
{ | ||
"name": "101", | ||
"version": "0.4.0", | ||
"version": "0.4.1", | ||
"description": "common javascript utils that can be required selectively that assume es5+", | ||
@@ -38,4 +38,5 @@ "main": "index.js", | ||
"keypather": "^1.6.0", | ||
"lab": "~3.1.1" | ||
"lab": "~3.1.1", | ||
"clone": "~0.1.15" | ||
} | ||
} |
@@ -267,4 +267,29 @@ 101 [![Build Status](https://travis-ci.org/tjmehta/101.svg?branch=master)](https://travis-ci.org/tjmehta/101) | ||
## set | ||
Functional version of obj[key] = val, returns a new obj with the key and value set. | ||
```js | ||
var set = require('101/set'); | ||
var obj = { | ||
foo: 1, | ||
bar: 2 | ||
}; | ||
set(obj, 'foo'); // 1 | ||
// use it with array.map | ||
[obj, obj, obj].map(set('foo', 100)); // [{ foo: 100, bar: 2 }, {same}, {same}] | ||
// supports keypaths by default | ||
var obj = { | ||
foo: 1, | ||
bar: 2 | ||
}; | ||
set(obj, 'foo', 100); // { foo: 100, bar:2 } | ||
``` | ||
## License | ||
MIT |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
52383
46
1550
295
4
+ Addedclone@~0.1.15
+ Addedclone@0.1.19(transitive)