Skip to content

Instantly share code, notes, and snippets.

@Radagaisus
Created July 4, 2012 21:37
Show Gist options
  • Select an option

  • Save Radagaisus/3049664 to your computer and use it in GitHub Desktop.

Select an option

Save Radagaisus/3049664 to your computer and use it in GitHub Desktop.
from array, get a: 2
does = from = (arr, using) ->
for i in arr when using[0] i
return using[1] i
return using[2]
get = (obj) ->
for key,val of obj
return [
(i) -> i[key] is val
(i) -> i
(i) -> false
]
have_any = (obj) ->
for key, val of obj
return [
(i) -> i[key] is val
(i) -> true
(i) -> false
]
from array, get a: 2
does array, have_any c: 5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment