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.
 
 
 
 

11 lines
229 B

module.exports = function getPathFromJSON (path, json) {
if (typeof path === 'string') {
path = path.split(/\./)
}
if (path.length === 0) {
return json
}
return getPathFromJSON(path.slice(1), json[path[0]])
}