Skip to content

Instantly share code, notes, and snippets.

@Quadriphobs1
Created January 23, 2019 12:46
Show Gist options
  • Select an option

  • Save Quadriphobs1/e1cd932c9dbbdfb87ba50459262b8b32 to your computer and use it in GitHub Desktop.

Select an option

Save Quadriphobs1/e1cd932c9dbbdfb87ba50459262b8b32 to your computer and use it in GitHub Desktop.
Object key resover
function resolve(path, obj=self, separator='.') {
var properties = Array.isArray(path) ? path : path.split(separator)
return properties.reduce((prev, curr) => prev && prev[curr], obj)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment