You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
373 B
17 lines
373 B
2 years ago
|
var isUndef = require('./isUndef');
|
||
|
var castPath = require('./castPath');
|
||
|
exports = function(obj, path) {
|
||
|
path = castPath(path, obj);
|
||
|
var prop, ret;
|
||
|
|
||
|
while ((prop = path.shift())) {
|
||
|
ret = obj[prop];
|
||
|
if (path.length === 0) delete obj[prop];
|
||
|
obj = ret;
|
||
|
if (isUndef(obj)) return;
|
||
|
}
|
||
|
return ret;
|
||
|
};
|
||
|
|
||
|
module.exports = exports;
|