00001 var castPath = require('./_castPath'), 00002 toKey = require('./_toKey'); 00003 00012 function baseGet(object, path) { 00013 path = castPath(path, object); 00014 00015 var index = 0, 00016 length = path.length; 00017 00018 while (object != null && index < length) { 00019 object = object[toKey(path[index++])]; 00020 } 00021 return (index && index == length) ? object : undefined; 00022 } 00023 00024 module.exports = baseGet;