diff --git a/src/array/concat.js b/src/array/concat.js
index 913d1870..11198823 100644
--- a/src/array/concat.js
+++ b/src/array/concat.js
@@ -1,5 +1,5 @@
import _concat from 'lodash/concat'
-import { convert } from 'util/convert'
+import { convert } from 'core/convert'
/**
* Replaces an array concatenating the former array with additional arrays and/or values.
diff --git a/src/array/convertArrayMethod.js b/src/array/convertArrayMethod.js
index ec15d6b3..43883faf 100644
--- a/src/array/convertArrayMethod.js
+++ b/src/array/convertArrayMethod.js
@@ -1,20 +1,22 @@
-import { convert } from 'util/convert'
-import isArray from 'lodash/isArray'
-import toArray from 'lodash/toArray'
+import { convert } from 'core/convert'
+
+const copyArray = array => {
+ if (array === undefined || array === null) return []
+ if (Array.isArray(array)) return [...array]
+ return [array]
+}
/**
* Converts an Array method.
* @memberof array
* @param {string} method Array method name.
* @return {function} Returns the wrapped function.
- * @see {@link util.convert|convert} for more information.
- * @see {@link https://lodash.com/docs#isArray|lodash.isArray} for more information.
- * @see {@link https://lodash.com/docs#toArray|lodash.toArray} for more information.
+ * @see {@link core.convert|convert} for more information.
* @since 0.2.0
* @private
*/
const convertArrayMethod = method => convert((array, ...args) => {
- const newArray = isArray(array) ? array : toArray(array)
+ const newArray = copyArray(array)
newArray[method](...args)
return newArray
})
diff --git a/src/array/difference.js b/src/array/difference.js
index 7a197570..ac2f1c72 100644
--- a/src/array/difference.js
+++ b/src/array/difference.js
@@ -1,5 +1,5 @@
import _difference from 'lodash/difference'
-import { convert } from 'util/convert'
+import { convert } from 'core/convert'
/**
* Replaces an array removing values in the other given arrays from the former array.
diff --git a/src/array/differenceBy.js b/src/array/differenceBy.js
index 84db85e3..84165c9a 100644
--- a/src/array/differenceBy.js
+++ b/src/array/differenceBy.js
@@ -1,5 +1,5 @@
import _differenceBy from 'lodash/differenceBy'
-import { convert } from 'util/convert'
+import { convert } from 'core/convert'
/**
* This method is like {@link array.difference} except that it uses iteratee
to generate the value to be compared for each element.
diff --git a/src/array/differenceWith.js b/src/array/differenceWith.js
index eef4b812..cb758ca0 100644
--- a/src/array/differenceWith.js
+++ b/src/array/differenceWith.js
@@ -1,5 +1,5 @@
import _differenceWith from 'lodash/differenceWith'
-import { convert } from 'util/convert'
+import { convert } from 'core/convert'
/**
* This method is like {@link array.difference} except that it uses comparator
to compare elements of the former array to values
.
diff --git a/src/array/drop.js b/src/array/drop.js
index 76fa4f78..a2b2dd25 100644
--- a/src/array/drop.js
+++ b/src/array/drop.js
@@ -1,5 +1,5 @@
import _drop from 'lodash/drop'
-import { convert } from 'util/convert'
+import { convert } from 'core/convert'
/**
* Replaces an array dropping one or several elements at the start of the former array.
diff --git a/src/array/dropRight.js b/src/array/dropRight.js
index 28a63d94..57660fcb 100644
--- a/src/array/dropRight.js
+++ b/src/array/dropRight.js
@@ -1,5 +1,5 @@
import _dropRight from 'lodash/dropRight'
-import { convert } from 'util/convert'
+import { convert } from 'core/convert'
/**
* Replaces an array dropping one or several elements at the end of the former array.
diff --git a/src/array/dropRightWhile.js b/src/array/dropRightWhile.js
index 2c0107bc..483af12f 100644
--- a/src/array/dropRightWhile.js
+++ b/src/array/dropRightWhile.js
@@ -1,5 +1,5 @@
import _dropRightWhile from 'lodash/dropRightWhile'
-import { convert } from 'util/convert'
+import { convert } from 'core/convert'
/**
* Replaces an array excluding elements dropped from the end. Elements are dropped until predicate
returns falsey.
diff --git a/src/array/dropWhile.js b/src/array/dropWhile.js
index 6f1e2eb8..27ca4ccf 100644
--- a/src/array/dropWhile.js
+++ b/src/array/dropWhile.js
@@ -1,5 +1,5 @@
import _dropWhile from 'lodash/dropWhile'
-import { convert } from 'util/convert'
+import { convert } from 'core/convert'
/**
* Replaces an array excluding elements dropped from the beginning. Elements are dropped until predicate
returns falsey.
diff --git a/src/array/fill.js b/src/array/fill.js
index 04a03ae0..4491abf0 100644
--- a/src/array/fill.js
+++ b/src/array/fill.js
@@ -1,5 +1,5 @@
-import _fill from 'lodash/fill.js'
-import { convert } from 'util/convert'
+import _fill from 'lodash/fp/fill'
+import { convertLodashFp } from 'util/convert'
/**
* Replaces by an array filled with value from start up to, but not including, end.
@@ -15,5 +15,5 @@ import { convert } from 'util/convert'
* @see {@link https://lodash.com/docs#fill|lodash.fill} for more information.
* @since 0.3.0
*/
-const fill = convert(_fill)
+const fill = convertLodashFp(_fill)
export { fill }
diff --git a/src/array/intersection.js b/src/array/intersection.js
index bb72e1dd..b8013e55 100644
--- a/src/array/intersection.js
+++ b/src/array/intersection.js
@@ -1,5 +1,5 @@
import _intersection from 'lodash/intersection'
-import { convert } from 'util/convert'
+import { convert } from 'core/convert'
/**
* Replaces by an array of unique values that are included in th former array and all given arrays.
diff --git a/src/array/intersectionBy.js b/src/array/intersectionBy.js
index dcc0bc66..49a0550e 100644
--- a/src/array/intersectionBy.js
+++ b/src/array/intersectionBy.js
@@ -1,5 +1,5 @@
import _intersectionBy from 'lodash/intersectionBy'
-import { convert } from 'util/convert'
+import { convert } from 'core/convert'
/**
* This method is like {@link array.intersection} except that it uses iteratee
to generate the value to be compared for each element.
diff --git a/src/array/intersectionWith.js b/src/array/intersectionWith.js
index 37368ce3..51e395d9 100644
--- a/src/array/intersectionWith.js
+++ b/src/array/intersectionWith.js
@@ -1,5 +1,5 @@
import _intersectionWith from 'lodash/intersectionWith'
-import { convert } from 'util/convert'
+import { convert } from 'core/convert'
/**
* This method is like {@link array.intersection} except that it uses comparator
to compare elements of the former array to arrays
.
diff --git a/src/array/pull.js b/src/array/pull.js
index 066775de..96700003 100644
--- a/src/array/pull.js
+++ b/src/array/pull.js
@@ -1,5 +1,5 @@
-import _pull from 'lodash/pull'
-import { convert } from 'util/convert'
+import _pull from 'lodash/fp/pull'
+import { convertLodashFp } from 'util/convert'
/**
* Replaces an array removing all given values from the former array.
@@ -13,5 +13,5 @@ import { convert } from 'util/convert'
* @see {@link https://lodash.com/docs#pull|lodash.pull} for more information.
* @since 0.2.0
*/
-const pull = convert(_pull)
+const pull = convertLodashFp(_pull)
export { pull }
diff --git a/src/array/pullAll.js b/src/array/pullAll.js
index 15ca7d9f..8a064043 100644
--- a/src/array/pullAll.js
+++ b/src/array/pullAll.js
@@ -1,5 +1,5 @@
-import _pullAll from 'lodash/pullAll'
-import { convert } from 'util/convert'
+import _pullAll from 'lodash/fp/pullAll'
+import { convertLodashFp } from 'util/convert'
/**
* This method is like {@link array.pull} except that it accepts an array of values to remove.
@@ -13,5 +13,5 @@ import { convert } from 'util/convert'
* @see {@link https://lodash.com/docs#pullAll|lodash.pullAll} for more information.
* @since 0.3.0
*/
-const pullAll = convert(_pullAll)
+const pullAll = convertLodashFp(_pullAll)
export { pullAll }
diff --git a/src/array/pullAllBy.js b/src/array/pullAllBy.js
index 263d6bbe..121323b5 100644
--- a/src/array/pullAllBy.js
+++ b/src/array/pullAllBy.js
@@ -1,5 +1,5 @@
-import _pullAllBy from 'lodash/pullAllBy'
-import { convert } from 'util/convert'
+import _pullAllBy from 'lodash/fp/pullAllBy'
+import { convertLodashFp } from 'util/convert'
/**
* This method is like {@link array.pullAll} except that it accepts iteratee
to generate the criterion by which each element is compared.
@@ -14,5 +14,5 @@ import { convert } from 'util/convert'
* @see {@link https://lodash.com/docs#pullAllBy|lodash.pullAllBy} for more information.
* @since 0.3.0
*/
-const pullAllBy = convert(_pullAllBy)
+const pullAllBy = convertLodashFp(_pullAllBy)
export { pullAllBy }
diff --git a/src/array/pullAllWith.js b/src/array/pullAllWith.js
index d5534f8b..54956fcf 100644
--- a/src/array/pullAllWith.js
+++ b/src/array/pullAllWith.js
@@ -1,5 +1,5 @@
-import _pullAllWith from 'lodash/pullAllWith'
-import { convert } from 'util/convert'
+import _pullAllWith from 'lodash/fp/pullAllWith'
+import { convertLodashFp } from 'util/convert'
/**
* This method is like {@link array.pullAll} except that it accepts comparator
to compare elements.
@@ -14,5 +14,5 @@ import { convert } from 'util/convert'
* @see {@link https://lodash.com/docs#pullAllWith|lodash.pullAllWith} for more information.
* @since 0.3.0
*/
-const pullAllWith = convert(_pullAllWith)
+const pullAllWith = convertLodashFp(_pullAllWith)
export { pullAllWith }
diff --git a/src/array/pullAt.js b/src/array/pullAt.js
index 1dc66516..61773cbc 100644
--- a/src/array/pullAt.js
+++ b/src/array/pullAt.js
@@ -1,5 +1,5 @@
-import _pullAt from 'lodash/pullAt'
-import { convert } from 'util/convert'
+import _pullAt from 'lodash/fp/pullAt'
+import { convertLodashFp } from 'util/convert'
/**
* Replaces an array removing the specified indexes from the former array.
@@ -13,8 +13,5 @@ import { convert } from 'util/convert'
* @see {@link https://lodash.com/docs#pullAt|lodash.pullAt} for more information.
* @since 0.3.0
*/
-const pullAt = convert((array, predicate) => {
- _pullAt(array, predicate)
- return array
-})
+const pullAt = convertLodashFp(_pullAt)
export { pullAt }
diff --git a/src/array/push.spec.js b/src/array/push.spec.js
index 967017b6..ee898eed 100644
--- a/src/array/push.spec.js
+++ b/src/array/push.spec.js
@@ -39,4 +39,12 @@ describe('Push', () => {
return output
}, undefined, 'nested.prop')
})
+
+ it('should wrap value in an array', () => {
+ immutaTest((input, path) => {
+ const output = push(input, path, 2)
+ expect(output).toEqual({ nested: { prop: [1, 2] } })
+ return output
+ }, { nested: { prop: 1 } }, 'nested.prop')
+ })
})
diff --git a/src/array/remove.js b/src/array/remove.js
index 1d5dd3fc..83b2fcfb 100644
--- a/src/array/remove.js
+++ b/src/array/remove.js
@@ -1,5 +1,5 @@
-import _remove from 'lodash/remove'
-import { convert } from 'util/convert'
+import _remove from 'lodash/fp/remove'
+import { convertLodashFp } from 'util/convert'
/**
* Replaces an array removing elements that predicate returns truthy for from the former array.
@@ -13,8 +13,5 @@ import { convert } from 'util/convert'
* @see {@link https://lodash.com/docs#remove|lodash.remove} for more information.
* @since 0.2.0
*/
-const remove = convert((array, predicate) => {
- _remove(array, predicate)
- return array
-})
+const remove = convertLodashFp(_remove)
export { remove }
diff --git a/src/array/reverse.js b/src/array/reverse.js
index aa1d3f67..d9639b5c 100644
--- a/src/array/reverse.js
+++ b/src/array/reverse.js
@@ -1,5 +1,5 @@
-import _reverse from 'lodash/reverse'
-import { convert } from 'util/convert'
+import _reverse from 'lodash/fp/reverse'
+import { convertLodashFp } from 'util/convert'
/**
* Replaces an array reversing the elements from the former array.
@@ -12,5 +12,5 @@ import { convert } from 'util/convert'
* @see {@link https://lodash.com/docs#reverse|lodash.reverse} for more information.
* @since 0.3.0
*/
-const reverse = convert(_reverse)
+const reverse = convertLodashFp(_reverse)
export { reverse }
diff --git a/src/array/slice.js b/src/array/slice.js
index 59327e9a..c8df8d57 100644
--- a/src/array/slice.js
+++ b/src/array/slice.js
@@ -1,5 +1,5 @@
import _slice from 'lodash/slice'
-import { convert } from 'util/convert'
+import { convert } from 'core/convert'
/**
* Replaces an array by a slice of the former array from start
up to, but not including, end
.
diff --git a/src/array/take.js b/src/array/take.js
index c5b71978..b7a62128 100644
--- a/src/array/take.js
+++ b/src/array/take.js
@@ -1,5 +1,5 @@
import _take from 'lodash/take'
-import { convert } from 'util/convert'
+import { convert } from 'core/convert'
/**
* Creates a slice of array with n
elements taken from the beginning.
diff --git a/src/array/takeRight.js b/src/array/takeRight.js
index c5c20e28..67154a0c 100644
--- a/src/array/takeRight.js
+++ b/src/array/takeRight.js
@@ -1,5 +1,5 @@
import _takeRight from 'lodash/takeRight'
-import { convert } from 'util/convert'
+import { convert } from 'core/convert'
/**
* Creates a slice of array with n
elements taken from the end.
diff --git a/src/array/takeRightWhile.js b/src/array/takeRightWhile.js
index 778f75e8..abaa0e85 100644
--- a/src/array/takeRightWhile.js
+++ b/src/array/takeRightWhile.js
@@ -1,5 +1,5 @@
import _takeRightWhile from 'lodash/takeRightWhile'
-import { convert } from 'util/convert'
+import { convert } from 'core/convert'
/**
* Creates a slice of array with elements taken from the end.
diff --git a/src/array/takeWhile.js b/src/array/takeWhile.js
index 839fe009..5f69bd10 100644
--- a/src/array/takeWhile.js
+++ b/src/array/takeWhile.js
@@ -1,5 +1,5 @@
import _takeWhile from 'lodash/takeWhile'
-import { convert } from 'util/convert'
+import { convert } from 'core/convert'
/**
* Creates a slice of array with elements taken from the beginning.
diff --git a/src/array/union.js b/src/array/union.js
index ad907e83..37d15170 100644
--- a/src/array/union.js
+++ b/src/array/union.js
@@ -1,5 +1,5 @@
import _union from 'lodash/union'
-import { convert } from 'util/convert'
+import { convert } from 'core/convert'
/**
* Replaces an array by an array of unique values, in order, from the former array and the given arrays.
diff --git a/src/array/unionBy.js b/src/array/unionBy.js
index d30527d9..df9d6975 100644
--- a/src/array/unionBy.js
+++ b/src/array/unionBy.js
@@ -1,5 +1,5 @@
import _unionBy from 'lodash/unionBy'
-import { convert } from 'util/convert'
+import { convert } from 'core/convert'
/**
* This method is like {@link array.union} except that it accepts iteratee
to generate the criterion by which elements are compared.
diff --git a/src/array/unionWith.js b/src/array/unionWith.js
index 3573a72e..51c08cd0 100644
--- a/src/array/unionWith.js
+++ b/src/array/unionWith.js
@@ -1,5 +1,5 @@
import _unionWith from 'lodash/unionWith'
-import { convert } from 'util/convert'
+import { convert } from 'core/convert'
/**
* This method is like {@link array.union} except that it accepts comparator
to compare elements.
diff --git a/src/array/xor.js b/src/array/xor.js
index dc08d08d..6234262a 100644
--- a/src/array/xor.js
+++ b/src/array/xor.js
@@ -1,5 +1,5 @@
import _xor from 'lodash/xor'
-import { convert } from 'util/convert'
+import { convert } from 'core/convert'
/**
* Replaces an array by the symmetric difference of the former array and the given arrays.
diff --git a/src/array/xorBy.js b/src/array/xorBy.js
index c4cda37e..46928d1e 100644
--- a/src/array/xorBy.js
+++ b/src/array/xorBy.js
@@ -1,5 +1,5 @@
import _xorBy from 'lodash/xorBy'
-import { convert } from 'util/convert'
+import { convert } from 'core/convert'
/**
* This method is like {@link array.xor} except that it accepts iteratee
to generate the criterion by which elements are compared.
diff --git a/src/array/xorWith.js b/src/array/xorWith.js
index 982e89f1..9e4f61d3 100644
--- a/src/array/xorWith.js
+++ b/src/array/xorWith.js
@@ -1,5 +1,5 @@
import _xorWith from 'lodash/xorWith'
-import { convert } from 'util/convert'
+import { convert } from 'core/convert'
/**
* This method is like {@link array.xor} except that it accepts comparator
to compare elements.
diff --git a/src/collection/filter.js b/src/collection/filter.js
index 9d771157..599ca5e7 100644
--- a/src/collection/filter.js
+++ b/src/collection/filter.js
@@ -1,5 +1,5 @@
import _filter from 'lodash/filter'
-import { convert } from 'util/convert'
+import { convert } from 'core/convert'
/**
* Replaces by an array of elements predicate
returns truthy for.
diff --git a/src/collection/map.js b/src/collection/map.js
index 51ece32b..af3d154e 100644
--- a/src/collection/map.js
+++ b/src/collection/map.js
@@ -1,5 +1,5 @@
import _map from 'lodash/map'
-import { convert } from 'util/convert'
+import { convert } from 'core/convert'
/**
* Replaces by an array of values by running each element in the former collection thru iteratee.
diff --git a/src/collection/orderBy.js b/src/collection/orderBy.js
index 2fc6ef09..84032a93 100644
--- a/src/collection/orderBy.js
+++ b/src/collection/orderBy.js
@@ -1,5 +1,5 @@
import _orderBy from 'lodash/orderBy'
-import { convert } from 'util/convert'
+import { convert } from 'core/convert'
/**
* Replaces by an array of sorted by iteratees
in specified orders
.
diff --git a/src/collection/reject.js b/src/collection/reject.js
index fb0d6c9b..4cf434bc 100644
--- a/src/collection/reject.js
+++ b/src/collection/reject.js
@@ -1,5 +1,5 @@
import _reject from 'lodash/reject'
-import { convert } from 'util/convert'
+import { convert } from 'core/convert'
/**
* Replaces by an array of elements predicate
returns falsy for.
diff --git a/src/collection/shuffle.js b/src/collection/shuffle.js
index bf64fef4..9f42f690 100644
--- a/src/collection/shuffle.js
+++ b/src/collection/shuffle.js
@@ -1,5 +1,5 @@
import _shuffle from 'lodash/shuffle'
-import { convert } from 'util/convert'
+import { convert } from 'core/convert'
/**
* Replaces by an array of shuffled elements.
diff --git a/src/collection/sortBy.js b/src/collection/sortBy.js
index 531a35c6..5e427d93 100644
--- a/src/collection/sortBy.js
+++ b/src/collection/sortBy.js
@@ -1,5 +1,5 @@
import _sortBy from 'lodash/sortBy'
-import { convert } from 'util/convert'
+import { convert } from 'core/convert'
/**
* Replaces by an array of sorted by iteratees
.
diff --git a/src/core/convert.js b/src/core/convert.js
new file mode 100644
index 00000000..8cea8656
--- /dev/null
+++ b/src/core/convert.js
@@ -0,0 +1,21 @@
+import { update } from 'core/update'
+
+/**
+ * Wraps an updater
function, returning a new function taking object
, path
and …args
as parameters.
+ * The updater
function is invoked with value
and …args
.
+ * Be carefull, the updater
function must not mutate its value
argument.
+ * @memberof core
+ * @param {function} updater The updater function.
+ * @return {function} Returns the wrapped function.
+ * @example
!
to the property.
diff --git a/src/math/add.js b/src/math/add.js
index 4eef0d4e..76ea2619 100644
--- a/src/math/add.js
+++ b/src/math/add.js
@@ -1,5 +1,5 @@
import _add from 'lodash/add'
-import { convert } from 'util/convert'
+import { convert } from 'core/convert'
/**
* Replaces by the addition of the former number and the given number.
diff --git a/src/math/divide.js b/src/math/divide.js
index 8f9b003a..978af972 100644
--- a/src/math/divide.js
+++ b/src/math/divide.js
@@ -1,5 +1,5 @@
import _divide from 'lodash/divide'
-import { convert } from 'util/convert'
+import { convert } from 'core/convert'
/**
* Replaces by the division of the former number and the given number.
diff --git a/src/math/multiply.js b/src/math/multiply.js
index d9553e4e..58cd26dc 100644
--- a/src/math/multiply.js
+++ b/src/math/multiply.js
@@ -1,5 +1,5 @@
import _multiply from 'lodash/multiply'
-import { convert } from 'util/convert'
+import { convert } from 'core/convert'
/**
* Replaces by the multiplication of the former number and the given number.
diff --git a/src/math/subtract.js b/src/math/subtract.js
index 26cae1cc..e32f29e8 100644
--- a/src/math/subtract.js
+++ b/src/math/subtract.js
@@ -1,5 +1,5 @@
import _subtract from 'lodash/subtract'
-import { convert } from 'util/convert'
+import { convert } from 'core/convert'
/**
* Replaces by the subtraction of the former number by the given number.
diff --git a/src/object/assign.js b/src/object/assign.js
index ef3ee76e..46d99664 100644
--- a/src/object/assign.js
+++ b/src/object/assign.js
@@ -1,5 +1,5 @@
-import _assign from 'lodash/assign'
-import { convert } from 'util/convert'
+import _assign from 'lodash/fp/assign'
+import { convertLodashFp } from 'util/convert'
/**
* Replaces by an object assigning own enumerable string keyed properties of source objects to the destination object.undefined
.iteratee
.
diff --git a/src/object/mapValues.js b/src/object/mapValues.js
index 732773a5..6b074161 100644
--- a/src/object/mapValues.js
+++ b/src/object/mapValues.js
@@ -1,5 +1,5 @@
import _mapValues from 'lodash/mapValues'
-import { convert } from 'util/convert'
+import { convert } from 'core/convert'
/**
* Replaces by an object with the same keys as the former object and values generated by running each own enumerable string keyed property of object thru iteratee
.
diff --git a/src/object/omit.js b/src/object/omit.js
index cc166913..2b990df6 100644
--- a/src/object/omit.js
+++ b/src/object/omit.js
@@ -1,5 +1,5 @@
import _omit from 'lodash/omit'
-import { convert } from 'util/convert'
+import { convert } from 'core/convert'
/**
* Replaces by an object omitting specified properties.
diff --git a/src/object/omitBy.js b/src/object/omitBy.js
index 85978276..8582f4e7 100644
--- a/src/object/omitBy.js
+++ b/src/object/omitBy.js
@@ -1,5 +1,5 @@
import _omitBy from 'lodash/omitBy'
-import { convert } from 'util/convert'
+import { convert } from 'core/convert'
/**
* Replaces by an object omitting properties that predicate
doesn't return truthy for.
diff --git a/src/object/pick.js b/src/object/pick.js
index 2d7dff64..d5d3f1f6 100644
--- a/src/object/pick.js
+++ b/src/object/pick.js
@@ -1,5 +1,5 @@
import _pick from 'lodash/pick'
-import { convert } from 'util/convert'
+import { convert } from 'core/convert'
/**
* Replaces by an object picking specified properties.
diff --git a/src/object/pickBy.js b/src/object/pickBy.js
index d2a8df56..4b8d10f3 100644
--- a/src/object/pickBy.js
+++ b/src/object/pickBy.js
@@ -1,5 +1,5 @@
import _pickBy from 'lodash/pickBy'
-import { convert } from 'util/convert'
+import { convert } from 'core/convert'
/**
* Replaces by an object picking properties that predicate
returns truthy for.
diff --git a/src/object/update.js b/src/object/update.js
index 300c3474..ba7fa100 100644
--- a/src/object/update.js
+++ b/src/object/update.js
@@ -1,30 +1,5 @@
-import _update from 'lodash/fp/update'
-import { lodashFpConvert } from 'util/lodashFpConvert'
import { update } from 'core/update'
-const convertedUpdate = lodashFpConvert(_update)
-
-/**
- * Updates the value at path
of object
using the updater
function.value
and …args
.updater
function must not mutate its value
argument.
- * @function
- * @memberof object
- * @param {Object} object The object to modify.
- * @param {Array|string} path The path of the property to set.
- * @param {function} updater The function to produce the updated value.
- * @param {...*} args The remaining args.
- * @return {Object} Returns the updated object.
- * @example updater
function, returning a new function taking object
, path
and …args
as parameters.updater
function is invoked with value
and …args
.updater
function must not mutate its value
argument.
- * @memberof util
- * @param {function} updater The updater function.
- * @return {function} Returns the wrapped function.
- * @example