omnibelt/round.js

  1. const compose = require('ramda/src/compose');
  2. const curryN = require('ramda/src/curryN');
  3. const flip = require('ramda/src/flip');
  4. const _round = require('lodash/round');
  5. /**
  6. * Curried FP version of `lodash.round`
  7. * NOTE: `lodash/fp.round` has a fixed arity of one, therefore
  8. * a precision cannot be specified.
  9. *
  10. * @signature Number -> Number -> Number
  11. * @see lodash.round
  12. */
  13. const round = compose(flip, curryN(2))(_round);
  14. module.exports = round;