Comparing version 1.0.1 to 1.1.0
@@ -8,2 +8,3 @@ 'use strict'; | ||
exports.copyWithDeepVal = require('./copyWithDeepVal'); | ||
exports.copyWithDeepFn = require('./copyWithDeepFn'); | ||
exports.firstIfSame = require('./firstIfSame'); |
{ | ||
"name": "copy-with", | ||
"version": "1.0.1", | ||
"version": "1.1.0", | ||
"main": "lib/index", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -91,2 +91,13 @@ # copy-with | ||
### cw.copyWithDeepFn(input, path, fn) | ||
Returns a copy of `input` where the deeply nested property at `path` (which is an array of string keys) has been set to the return value of calling `fn` with the current value. Useful for situations where you want to modify a value rather than replacing it, which would otherwise require listing the path twice. | ||
Examples: | ||
```js | ||
copyWithDeepFn({ x: { y: { z: 1 } } }, ['x', 'y', 'z'], z => z + 1) // { x: { y: { z: 2 } } } | ||
copyWithDeepFn({ x: { y: { z: [1, 2] } } }, ['x', 'y', 'z'], z => z.concat([3, 4])) // { x: { y: { z: [1, 2, 3, 4] } } } | ||
``` | ||
### cw.firstIfSame(original, modified) | ||
@@ -93,0 +104,0 @@ |
@@ -8,2 +8,3 @@ 'use strict'; | ||
exports.copyWithDeepVal = require('./copyWithDeepVal'); | ||
exports.copyWithDeepFn = require('./copyWithDeepFn'); | ||
exports.firstIfSame = require('./firstIfSame'); |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
11816
19
160
137
1