Created
May 27, 2016 12:24
-
-
Save yashikagarg13/57a3d4536934b7cb524f558727da7078 to your computer and use it in GitHub Desktop.
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
var R = require("ramda"); | |
var sales = [ {id: 1, price: 500}, {id: 2, price: 1500}, {id: 3, price: 750}, {id: 4, price: 1750}, {id: 5, price: 150}, {id: 3, price: 750}, ]; | |
var resultWithoutRamda = sales.filter(sale => sale.price < 1000) | |
.map(sale => sale.price) | |
.sort((a, b) => a-b); | |
console.log(resultWithoutRamda); | |
var resultWithRamda = R.pipe( | |
R.filter(sale => sale.price < 1000), | |
R.map(sale => sale.price), | |
R.sort((a,b) => a-b) | |
)(sales); | |
console.log(resultWithRamda); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment