web-profile

Ramda reverse

js:

var data = [
 {fname: 'Roy', lname: 'Red'},
 {fname: 'Gary', lname: 'Green'},
 {fname: 'Bob', lname: 'Blue'},
];

var dataUpd = R.pipe(
  R.reverse,
  R.take(2),
  //R.takeLast(2),
)(data);

alert( JSON.stringify(dataUpd) );

Result:

Leave a Reply

Your email address will not be published.