Created
July 27, 2016 16:35
-
-
Save jeromelachaud/e6e567d70bc5ae65467c5d1845c4f5b3 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
var comics = [ | |
{ | |
pages: 100, | |
price: 100 | |
}, | |
{ | |
pages: 100, | |
price: 50 | |
}, | |
{ | |
pages: 50, | |
price: 10 | |
} | |
]; | |
var filterLte50 = _.filter(function(num) { | |
return num <= 50; | |
}); | |
var filterLt100 = _.filter(function(num) { | |
return num < 50; | |
}); | |
var filterPriceLte50 = _.flowRight([filterLte50, _.map(_.prop('price'))]); | |
var filterPagesLt100 = _.flowRight([filterLt100, _.map(_.prop('pages'))]); | |
console.log(filterPagesLt100(comics)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment