Skip to content

Instantly share code, notes, and snippets.

@lubien
Last active Aug 4, 2019
Embed
What would you like to do?
Dado o array de dictionary abaixo some o total dos valores (https://gist.github.com/anabastos/fbdfef7fcc64105e76e5e26218ebf7e6)
const
composeN = (...fs) => x =>
fs.reduceRight((x, f) => f(x), x)
, map = f => xs =>
xs.map(f)
, reduce = f => xs =>
xs.reduce(f)
, sum = (x, y) => x + y
, dictionary =
[ { '5': 50, '6': 60 }
, { 'A': 10 }
, { 'YEEZY': 30 }
]
composeN(
reduce(sum),
map(reduce(sum)),
map(Object.values)
)(dictionary)
@halan
Copy link

halan commented Mar 9, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment