source: node_modules/ramda-adjunct/es/isNonPositive.js

main
Last change on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago

Initial commit

  • Property mode set to 100644
File size: 901 bytes
Line 
1import { both, lte, flip, curryN } from 'ramda';
2import isNumber from './isNumber';
3
4/**
5 * Checks if value is a non-positive `Number` primitive or object. This includes all negative
6 * numbers and zero.
7 *
8 * @func isNonPositive
9 * @memberOf RA
10 * @since {@link https://char0n.github.io/ramda-adjunct/2.6.0|v2.6.0}
11 * @category Type
12 * @sig * -> Boolean
13 * @param {*} val The value to test
14 * @return {boolean}
15 * @see {@link RA.isNegative|isNegative}, {@link RA.isNonNegative|isNonNegative}
16 * @example
17 *
18 * RA.isNonPositive(0); // => true
19 * RA.isNonPositive(-1); // => true
20 * RA.isNonPositive(-Infinity); // => true
21 * RA.isNonPositive(Number.MIN_VALUE); // => true
22 *
23 * RA.isNonPositive(Infinity); // => false
24 * RA.isNonPositive(Number.MAX_VALUE); // => false
25 * RA.isNonPositive(NaN); // => false
26 */
27var isNonPositive = curryN(1, both(isNumber, flip(lte)(0)));
28export default isNonPositive;
Note: See TracBrowser for help on using the repository browser.