Security update for permissions_by_term
[yaffs-website] / node_modules / uncss / node_modules / lodash / set.js
1 var baseSet = require('./internal/baseSet');
2
3 /**
4  * Sets the value at `path` of `object`. If a portion of `path` doesn't exist
5  * it's created. Arrays are created for missing index properties while objects
6  * are created for all other missing properties. Use `_.setWith` to customize
7  * `path` creation.
8  *
9  * @static
10  * @memberOf _
11  * @category Object
12  * @param {Object} object The object to modify.
13  * @param {Array|string} path The path of the property to set.
14  * @param {*} value The value to set.
15  * @returns {Object} Returns `object`.
16  * @example
17  *
18  * var object = { 'a': [{ 'b': { 'c': 3 } }] };
19  *
20  * _.set(object, 'a[0].b.c', 4);
21  * console.log(object.a[0].b.c);
22  * // => 4
23  *
24  * _.set(object, 'x[0].y.z', 5);
25  * console.log(object.x[0].y.z);
26  * // => 5
27  */
28 function set(object, path, value) {
29   return object == null ? object : baseSet(object, path, value);
30 }
31
32 module.exports = set;