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:
1.1 KB
|
Rev | Line | |
---|
[d24f17c] | 1 | import { bind, curryN } from 'ramda';
|
---|
| 2 |
|
---|
| 3 | import isFunction from './isFunction';
|
---|
| 4 | import ponyfill from './internal/ponyfills/Number.isInteger';
|
---|
| 5 |
|
---|
| 6 | export const isIntegerPonyfill = curryN(1, ponyfill);
|
---|
| 7 |
|
---|
| 8 | /**
|
---|
| 9 | * Checks whether the passed value is an `integer`.
|
---|
| 10 | *
|
---|
| 11 | * @func isInteger
|
---|
| 12 | * @memberOf RA
|
---|
| 13 | * @since {@link https://char0n.github.io/ramda-adjunct/0.7.0|v0.7.0}
|
---|
| 14 | * @category Type
|
---|
| 15 | * @sig * -> Boolean
|
---|
| 16 | * @param {*} val The value to test
|
---|
| 17 | * @return {boolean}
|
---|
| 18 | * @see {@link RA.isNotInteger|isNotInteger}
|
---|
| 19 | * @example
|
---|
| 20 | *
|
---|
| 21 | * RA.isInteger(0); //=> true
|
---|
| 22 | * RA.isInteger(1); //=> true
|
---|
| 23 | * RA.isInteger(-100000); //=> true
|
---|
| 24 | *
|
---|
| 25 | * RA.isInteger(0.1); //=> false
|
---|
| 26 | * RA.isInteger(Math.PI); //=> false
|
---|
| 27 | *
|
---|
| 28 | * RA.isInteger(NaN); //=> false
|
---|
| 29 | * RA.isInteger(Infinity); //=> false
|
---|
| 30 | * RA.isInteger(-Infinity); //=> false
|
---|
| 31 | * RA.isInteger('10'); //=> false
|
---|
| 32 | * RA.isInteger(true); //=> false
|
---|
| 33 | * RA.isInteger(false); //=> false
|
---|
| 34 | * RA.isInteger([1]); //=> false
|
---|
| 35 | */
|
---|
| 36 | const isInteger = isFunction(Number.isInteger)
|
---|
| 37 | ? curryN(1, bind(Number.isInteger, Number))
|
---|
| 38 | : isIntegerPonyfill;
|
---|
| 39 |
|
---|
| 40 | export default isInteger;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.