Skip to content

Instantly share code, notes, and snippets.

@tiye
Created July 22, 2012 13:19
Show Gist options
  • Select an option

  • Save tiye/3159669 to your computer and use it in GitHub Desktop.

Select an option

Save tiye/3159669 to your computer and use it in GitHub Desktop.
curry 函数读取 object
a =
d: 2
b: '3'
c:
a: 'd'
f: 4
a:
a:
a:
a: 'i'
d: '3'
f = (key, o = a) ->
if typeof o[key] is 'object' then (k) -> f k, o[key]
else o[key]
console.log f('a')('a')('d')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment