This commit is contained in:
15
node_modules/licia/safeGet.js
generated
vendored
Normal file
15
node_modules/licia/safeGet.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
var isUndef = require('./isUndef');
|
||||
var castPath = require('./castPath');
|
||||
exports = function(obj, path) {
|
||||
path = castPath(path, obj);
|
||||
var prop;
|
||||
prop = path.shift();
|
||||
while (!isUndef(prop)) {
|
||||
obj = obj[prop];
|
||||
if (obj == null) return;
|
||||
prop = path.shift();
|
||||
}
|
||||
return obj;
|
||||
};
|
||||
|
||||
module.exports = exports;
|
||||
Reference in New Issue
Block a user