Simplify baseUnset.

This commit is contained in:
John-David Dalton
2016-11-15 18:07:27 -08:00
parent 89656fdf4a
commit 9a02bd5fc7

View File

@@ -3881,14 +3881,8 @@
var previous = index;
if (isIndex(index)) {
splice.call(array, index, 1);
}
else {
var path = castPath(index, array),
object = parent(array, path);
if (object != null) {
delete object[toKey(last(path))];
}
} else {
baseUnset(array, index);
}
}
}
@@ -4352,8 +4346,7 @@
function baseUnset(object, path) {
path = castPath(path, object);
object = parent(object, path);
var key = toKey(last(path));
return !(object != null && hasOwnProperty.call(object, key)) || delete object[key];
return object == null || delete object[toKey(last(path))];
}
/**