8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
baseUnset
1 parent 89656fd commit 9a02bd5Copy full SHA for 9a02bd5
lodash.js
@@ -3881,14 +3881,8 @@
3881
var previous = index;
3882
if (isIndex(index)) {
3883
splice.call(array, index, 1);
3884
- }
3885
- else {
3886
- var path = castPath(index, array),
3887
- object = parent(array, path);
3888
-
3889
- if (object != null) {
3890
- delete object[toKey(last(path))];
3891
+ } else {
+ baseUnset(array, index);
3892
}
3893
3894
@@ -4352,8 +4346,7 @@
4352
4346
function baseUnset(object, path) {
4353
4347
path = castPath(path, object);
4354
4348
object = parent(object, path);
4355
- var key = toKey(last(path));
4356
- return !(object != null && hasOwnProperty.call(object, key)) || delete object[key];
4349
+ return object == null || delete object[toKey(last(path))];
4357
4350
4358
4351
4359
/**
0 commit comments