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