DEV Community

Discussion on: Order of arguments in HOF

Collapse
 
avalander profile image
Avalander

I'm not sure, but ramda does it the other way around, which makes functions easier to reuse in my opinion

const { map, filter, pipe } = require('ramda')

const filterEvens = filter(x => x % 2 == 0)
const mapDouble = map(x => x * 2)

const doubleEvens = pipe(
  filterEvens,
  mapDouble
)

doubleEvens([ 1, 2, 3, 4 ]) // [ 4, 8 ])