|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 11 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
804 bytes
|
| Line | |
|---|
| 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 | * @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 | module.exports = unset;
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.