Last active
September 29, 2017 11:50
-
-
Save afontcu/428b1466f42d4fd550e5576e34283874 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 limit = 10 | |
const factor = 60 | |
const moreThan = x => element => element.amount > x | |
const applyFactor = x => element => element.time / x | |
const sumValues = (accumulator, currentValue) => accumulator + currentValue | |
list | |
.filter(moreThan(limit)) | |
.map(applyFactor(factor)) | |
.reduce(sumValues) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment