Skip to content

Instantly share code, notes, and snippets.

@yashikagarg13
Created May 27, 2016 12:24
Show Gist options
  • Save yashikagarg13/57a3d4536934b7cb524f558727da7078 to your computer and use it in GitHub Desktop.
Save yashikagarg13/57a3d4536934b7cb524f558727da7078 to your computer and use it in GitHub Desktop.
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