Created
January 27, 2016 17:18
-
-
Save tuxsudo/71b2f821e11a0bc492d8 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
| // ( (fn=>true), Array ) => { "true": [], "false": [] } | |
| function splitArray(fn, arr) { | |
| return arr.reduce((last, current) => { | |
| let key = fn( current ).toString(); | |
| last[key] = last[key].concat(current); | |
| return last; | |
| }, { "true": [], "false": [] } ); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment