Last change
on this file since 571e0df was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
580 bytes
|
Line | |
---|
1 | var castPath = require('./_castPath'),
|
---|
2 | last = require('./last'),
|
---|
3 | parent = require('./_parent'),
|
---|
4 | toKey = require('./_toKey');
|
---|
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 | module.exports = baseUnset;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.