source: trip-planner-front/node_modules/lodash/setWith.js@ 76712b2

Last change on this file since 76712b2 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1.0 KB
Line 
1var 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 * @since 4.0.0
14 * @category Object
15 * @param {Object} object The object to modify.
16 * @param {Array|string} path The path of the property to set.
17 * @param {*} value The value to set.
18 * @param {Function} [customizer] The function to customize assigned values.
19 * @returns {Object} Returns `object`.
20 * @example
21 *
22 * var object = {};
23 *
24 * _.setWith(object, '[0][1]', 'a', Object);
25 * // => { '0': { '1': 'a' } }
26 */
27function setWith(object, path, value, customizer) {
28 customizer = typeof customizer == 'function' ? customizer : undefined;
29 return object == null ? object : baseSet(object, path, value, customizer);
30}
31
32module.exports = setWith;
Note: See TracBrowser for help on using the repository browser.