Skip to content

Instantly share code, notes, and snippets.

@erikjung
Created March 2, 2018 10:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save erikjung/26717341312c91859f68bd66f213513c to your computer and use it in GitHub Desktop.
Save erikjung/26717341312c91859f68bd66f213513c to your computer and use it in GitHub Desktop.
A snippet to generate FP array one-liners
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