JavaScript



RamdaJs

  • emphasizes purer functional style
  • immutability and side-effect free functions
  • clean and elegant API
import * as R from 'ramda'

// NOTE: Destructuring imports from ramda does not necessarily prevent importing the entire library.
// You can manually cherry-pick methods like the following
import pick from 'ramda/src/pick';

pipe

  • performs left to right composition
const triple = (x) => x * 3;
const cube = (x) => x * x * x;

var output = pipe(cube, triple)(2);
console.log(output); // 24

compose

  • performs right to left composition
const triple = (x) => x * 3;
const cube = (x) => x * x * x;

var output = compose(cube, triple)(2);
console.log(output); // 216
Made with Gatsby G Logo