Last active
August 4, 2019 03:23
-
-
Save lubien/c13ac575efb408917b8a7bd66e0f35ce to your computer and use it in GitHub Desktop.
Dado o array de dictionary abaixo some o total dos valores (https://gist.github.com/anabastos/fbdfef7fcc64105e76e5e26218ebf7e6)
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 | |
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
commented
Mar 9, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment