main
Last change
on this file since d565449 was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
802 bytes
|
Rev | Line | |
---|
[d565449] | 1 | import baseUnset from './_baseUnset.js';
|
---|
| 2 |
|
---|
| 3 | /**
|
---|
| 4 | * Removes the property at `path` of `object`.
|
---|
| 5 | *
|
---|
| 6 | * **Note:** This method mutates `object`.
|
---|
| 7 | *
|
---|
| 8 | * @static
|
---|
| 9 | * @memberOf _
|
---|
| 10 | * @since 4.0.0
|
---|
| 11 | * @category Object
|
---|
| 12 | * @param {Object} object The object to modify.
|
---|
| 13 | * @param {Array|string} path The path of the property to unset.
|
---|
| 14 | * @returns {boolean} Returns `true` if the property is deleted, else `false`.
|
---|
| 15 | * @example
|
---|
| 16 | *
|
---|
| 17 | * var object = { 'a': [{ 'b': { 'c': 7 } }] };
|
---|
| 18 | * _.unset(object, 'a[0].b.c');
|
---|
| 19 | * // => true
|
---|
| 20 | *
|
---|
| 21 | * console.log(object);
|
---|
| 22 | * // => { 'a': [{ 'b': {} }] };
|
---|
| 23 | *
|
---|
| 24 | * _.unset(object, ['a', '0', 'b', 'c']);
|
---|
| 25 | * // => true
|
---|
| 26 | *
|
---|
| 27 | * console.log(object);
|
---|
| 28 | * // => { 'a': [{ 'b': {} }] };
|
---|
| 29 | */
|
---|
| 30 | function unset(object, path) {
|
---|
| 31 | return object == null ? true : baseUnset(object, path);
|
---|
| 32 | }
|
---|
| 33 |
|
---|
| 34 | export default unset;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.