Skip to content

Instantly share code, notes, and snippets.

@frostney
Created August 15, 2013 23:40
Show Gist options
  • Save frostney/6245988 to your computer and use it in GitHub Desktop.
Save frostney/6245988 to your computer and use it in GitHub Desktop.
Simple object traversion by dot notation
traverseObject = (o, key) ->
keyArray = if key.indexOf('.') > 0 then key.split('.') else [key]
for k in keyArray
return unless Object.hasOwnProperty.call o, k
o = o[k]
o
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment