91daee09d539b5da4ecf158cea25f6f74d2023ab
[yaffs-website] / node_modules / grunt-legacy-util / node_modules / lodash / unset.js
1 var baseUnset = require('./_baseUnset');
2
3 /**
4  * Removes the property at `path` of `object`.
5  *
6  * **Note:** This method mutates `object`.
7  *
8  * @static
9  * @memberOf _
10  * @category Object
11  * @param {Object} object The object to modify.
12  * @param {Array|string} path The path of the property to unset.
13  * @returns {boolean} Returns `true` if the property is deleted, else `false`.
14  * @example
15  *
16  * var object = { 'a': [{ 'b': { 'c': 7 } }] };
17  * _.unset(object, 'a[0].b.c');
18  * // => true
19  *
20  * console.log(object);
21  * // => { 'a': [{ 'b': {} }] };
22  *
23  * _.unset(object, 'a[0].b.c');
24  * // => true
25  *
26  * console.log(object);
27  * // => { 'a': [{ 'b': {} }] };
28  */
29 function unset(object, path) {
30   return object == null ? true : baseUnset(object, path);
31 }
32
33 module.exports = unset;