Ramda Adjunct 5.1.0

floor.js

  1. import { bind, curryN } from 'ramda';
  2. /**
  3. * Returns the largest integer less than or equal to a given number.
  4. *
  5. * Note: floor(null) returns integer 0 and do not give a NaN error.
  6. *
  7. * @func floor
  8. * @memberOf RA
  9. * @since {@link https://char0n.github.io/ramda-adjunct/2.15.0|v2.15.0}
  10. * @category Math
  11. * @sig Number -> Number
  12. * @param {number} number The number to floor
  13. * @return {number} A number representing the largest integer less than or equal to the specified number
  14. * @example
  15. *
  16. * RA.floor(45.95); //=> 45
  17. * RA.floor(45.05); //=> 45
  18. * RA.floor(4); //=> 4
  19. * RA.floor(-45.05); //=> -46
  20. * RA.floor(-45.95); //=> -46
  21. * RA.floor(null); //=> 0
  22. */
  23. const floor = curryN(1, bind(Math.floor, Math));
  24. export default floor;