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:
742 bytes
|
Rev | Line | |
---|
[d24f17c] | 1 | import { both, gt, curryN } from 'ramda';
|
---|
| 2 |
|
---|
| 3 | import isNumber from './isNumber';
|
---|
| 4 |
|
---|
| 5 | /**
|
---|
| 6 | * Checks if value is a negative `Number` primitive or object. Zero is not considered neither
|
---|
| 7 | * positive or negative.
|
---|
| 8 | *
|
---|
| 9 | * @func isNegative
|
---|
| 10 | * @memberOf RA
|
---|
| 11 | * @since {@link https://char0n.github.io/ramda-adjunct/1.15.0|v1.15.0}
|
---|
| 12 | * @category Type
|
---|
| 13 | * @sig * -> Boolean
|
---|
| 14 | * @param {*} val The value to test
|
---|
| 15 | * @return {boolean}
|
---|
| 16 | * @see {@link RA.isPositive|isPositive}
|
---|
| 17 | * @example
|
---|
| 18 | *
|
---|
| 19 | * RA.isNegative(-1); // => true
|
---|
| 20 | * RA.isNegative(Number.MIN_VALUE); // => false
|
---|
| 21 | * RA.isNegative(+Infinity); // => false
|
---|
| 22 | * RA.isNegative(NaN); // => false
|
---|
| 23 | * RA.isNegative('5'); // => false
|
---|
| 24 | */
|
---|
| 25 | const isNegative = curryN(1, both(isNumber, gt(0)));
|
---|
| 26 |
|
---|
| 27 | export default isNegative;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.