main
Last change
on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
578 bytes
|
Rev | Line | |
---|
[d565449] | 1 | import castPath from './_castPath.js';
|
---|
| 2 | import last from './last.js';
|
---|
| 3 | import parent from './_parent.js';
|
---|
| 4 | import toKey from './_toKey.js';
|
---|
| 5 |
|
---|
| 6 | /**
|
---|
| 7 | * The base implementation of `_.unset`.
|
---|
| 8 | *
|
---|
| 9 | * @private
|
---|
| 10 | * @param {Object} object The object to modify.
|
---|
| 11 | * @param {Array|string} path The property path to unset.
|
---|
| 12 | * @returns {boolean} Returns `true` if the property is deleted, else `false`.
|
---|
| 13 | */
|
---|
| 14 | function baseUnset(object, path) {
|
---|
| 15 | path = castPath(path, object);
|
---|
| 16 | object = parent(object, path);
|
---|
| 17 | return object == null || delete object[toKey(last(path))];
|
---|
| 18 | }
|
---|
| 19 |
|
---|
| 20 | export default baseUnset;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.