Skip to content

Instantly share code, notes, and snippets.

@micmmakarov
Last active August 29, 2015 14:26
Show Gist options
  • Save micmmakarov/1fbdb64adfbb1c54aa00 to your computer and use it in GitHub Desktop.
Save micmmakarov/1fbdb64adfbb1c54aa00 to your computer and use it in GitHub Desktop.
Recursive function to change hash by deep_path
Sonar.changeByArray = (hash, array, newValue) ->
obj = hash
i = 0
while i < array.length - 1
obj = obj[array[i++]]
obj[array[i]] = newValue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment