lodash get
function get(source, path, defaultValue = undefined){
const paths = path.replace(/\[(\d+)\]/g, '$1').split('.')
let result = source;
for(let p of paths){
result = Object(result)[p]
if(result === undefined){
return defaultValue
}
}
return result
}
标签:paths,return,lodash,get,defaultValue,result,手写
From: https://www.cnblogs.com/yiyunh/p/17007795.html