erikjung
3/2/2018 - 10:52 AM

A snippet to generate FP array one-liners

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)
}), {})