Ramda Adjunct 2.6.0

isPositive.js

  1. import { both, lt } from 'ramda';
  2. import isNumber from './isNumber';
  3. /**
  4. * Checks if value is a positive `Number` primitive or object. Zero is not considered positive.
  5. *
  6. * @func isPositive
  7. * @memberOf RA
  8. * @since {@link https://char0n.github.io/ramda-adjunct/1.15.0|v1.15.0}
  9. * @category Type
  10. * @sig * -> Boolean
  11. * @param {*} val The value to test
  12. * @return {Boolean}
  13. * @see {@link RA.isNegative|isNegative}
  14. * @example
  15. *
  16. * RA.isPositive(1); // => true
  17. * RA.isPositive(Number.MAX_VALUE); // => true
  18. * RA.isPositive(-Infinity); // => false
  19. * RA.isPositive(NaN); // => false
  20. * RA.isPositive('5'); // => false
  21. */
  22. const isPositive = both(isNumber, lt(0));
  23. export default isPositive;