Created
August 7, 2016 07:21
-
-
Save janwirth/832c5acc1c4ee0613a4e7fc15e7ea2bb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# deep map obj with function in context | |
deepMap = (obj, f, ctx) -> | |
res = {} | |
for key of obj | |
val = obj[key] | |
if typeof val == 'object' | |
res[key] = deepMap(val, f, ctx) | |
else | |
res[key] = f.call(ctx, val, key) | |
res |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment