Skip to content

Instantly share code, notes, and snippets.

@micmmakarov
Last active Aug 29, 2015
Embed
What would you like to do?
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