aboutsummaryrefslogtreecommitdiff
path: root/node_modules/lodash/assignInWith.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/lodash/assignInWith.js')
-rw-r--r--node_modules/lodash/assignInWith.js38
1 files changed, 38 insertions, 0 deletions
diff --git a/node_modules/lodash/assignInWith.js b/node_modules/lodash/assignInWith.js
new file mode 100644
index 0000000..68fcc0b
--- /dev/null
+++ b/node_modules/lodash/assignInWith.js
@@ -0,0 +1,38 @@
+var copyObject = require('./_copyObject'),
+ createAssigner = require('./_createAssigner'),
+ keysIn = require('./keysIn');
+
+/**
+ * This method is like `_.assignIn` except that it accepts `customizer`
+ * which is invoked to produce the assigned values. If `customizer` returns
+ * `undefined`, assignment is handled by the method instead. The `customizer`
+ * is invoked with five arguments: (objValue, srcValue, key, object, source).
+ *
+ * **Note:** This method mutates `object`.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.0.0
+ * @alias extendWith
+ * @category Object
+ * @param {Object} object The destination object.
+ * @param {...Object} sources The source objects.
+ * @param {Function} [customizer] The function to customize assigned values.
+ * @returns {Object} Returns `object`.
+ * @see _.assignWith
+ * @example
+ *
+ * function customizer(objValue, srcValue) {
+ * return _.isUndefined(objValue) ? srcValue : objValue;
+ * }
+ *
+ * var defaults = _.partialRight(_.assignInWith, customizer);
+ *
+ * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
+ * // => { 'a': 1, 'b': 2 }
+ */
+var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
+ copyObject(source, keysIn(source), object, customizer);
+});
+
+module.exports = assignInWith;