Security update for Core, with self-updated composer
[yaffs-website] / node_modules / grunt-legacy-util / node_modules / lodash / setWith.js
1 var baseSet = require('./_baseSet');
2
3 /**
4  * This method is like `_.set` except that it accepts `customizer` which is
5  * invoked to produce the objects of `path`.  If `customizer` returns `undefined`
6  * path creation is handled by the method instead. The `customizer` is invoked
7  * with three arguments: (nsValue, key, nsObject).
8  *
9  * **Note:** This method mutates `object`.
10  *
11  * @static
12  * @memberOf _
13  * @category Object
14  * @param {Object} object The object to modify.
15  * @param {Array|string} path The path of the property to set.
16  * @param {*} value The value to set.
17  * @param {Function} [customizer] The function to customize assigned values.
18  * @returns {Object} Returns `object`.
19  * @example
20  *
21  * _.setWith({ '0': { 'length': 2 } }, '[0][1][2]', 3, Object);
22  * // => { '0': { '1': { '2': 3 }, 'length': 2 } }
23  */
24 function setWith(object, path, value, customizer) {
25   customizer = typeof customizer == 'function' ? customizer : undefined;
26   return object == null ? object : baseSet(object, path, value, customizer);
27 }
28
29 module.exports = setWith;