Skip to content

Instantly share code, notes, and snippets.

@bnadlerjr
Created April 15, 2013 19:32
Show Gist options
  • Save bnadlerjr/5390674 to your computer and use it in GitHub Desktop.
Save bnadlerjr/5390674 to your computer and use it in GitHub Desktop.
Array::partition = (callback) ->
[positive, negative] = [[], []]
for item, index in @
(if callback item, index then positive else negative).push item
[positive, negative]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment