Skip to content

Instantly share code, notes, and snippets.

@acatl
Created December 3, 2012 16:38
Show Gist options
  • Save acatl/4196153 to your computer and use it in GitHub Desktop.
Save acatl/4196153 to your computer and use it in GitHub Desktop.
Parse JS object path that uses dot and bracket notation
parse = (obj, path) ->
path = path.split(/[\[\]\.]+/)
path.pop() if path[path.length - 1] is ""
while path.length and (obj = obj[path.shift()])
;
obj
@rafmagana
Copy link

any example?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment