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:
900 bytes
|
Line | |
---|
1 | import { both, gte, flip, curryN } from 'ramda';
|
---|
2 | import isNumber from './isNumber';
|
---|
3 |
|
---|
4 | /**
|
---|
5 | * Checks if value is a non-negative `Number` primitive or object. This includes all positive
|
---|
6 | * numbers and zero.
|
---|
7 | *
|
---|
8 | * @func isNonNegative
|
---|
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.isPositive|isPositive}, {@link RA.isNonPositive|isNonPositive}
|
---|
16 | * @example
|
---|
17 | *
|
---|
18 | * RA.isNonNegative(0); // => true
|
---|
19 | * RA.isNonNegative(1); // => true
|
---|
20 | * RA.isNonNegative(Infinity); // => true
|
---|
21 | * RA.isNonNegative(Number.MAX_VALUE); // => true
|
---|
22 | *
|
---|
23 | * RA.isNonNegative(-Infinity); // => false
|
---|
24 | * RA.isNonNegative(Number.MIN_VALUE); // => false
|
---|
25 | * RA.isNonNegative(NaN); // => false
|
---|
26 | */
|
---|
27 | var isNonNegative = curryN(1, both(isNumber, flip(gte)(0)));
|
---|
28 | export default isNonNegative; |
---|
Note:
See
TracBrowser
for help on using the repository browser.