Created
March 2, 2018 10:52
-
-
Save erikjung/26717341312c91859f68bd66f213513c to your computer and use it in GitHub Desktop.
A snippet to generate FP array one-liners
This file contains 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
const ArrayUtils = [ | |
'map', | |
'filter', | |
'find', | |
] | |
.reduce((utils, method) => ({ | |
...utils, | |
[method]: (fn, arr) => arr ? arr[method](fn) : arr => arr[method](fn) | |
}), {}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment