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

  1. module.exports = function getPathFromJSON (path, json) {
  2. if (typeof path === 'string') {
  3. path = path.split(/\./)
  4. }
  5. if (path.length === 0) {
  6. return json
  7. }
  8. return getPathFromJSON(path.slice(1), json[path[0]])
  9. }