main
|
Last change
on this file since d24f17c was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 18 months ago |
|
Initial commit
|
-
Property mode
set to
100644
|
|
File size:
943 bytes
|
| Line | |
|---|
| 1 | import { complement, both } from 'ramda';
|
|---|
| 2 |
|
|---|
| 3 | import isInteger from './isInteger';
|
|---|
| 4 | import isFinite from './isFinite';
|
|---|
| 5 |
|
|---|
| 6 | /**
|
|---|
| 7 | * Checks whether the passed value is a `float`.
|
|---|
| 8 | *
|
|---|
| 9 | * @func isFloat
|
|---|
| 10 | * @memberOf RA
|
|---|
| 11 | * @since {@link https://char0n.github.io/ramda-adjunct/1.14.0|v1.14.0}
|
|---|
| 12 | * @category Type
|
|---|
| 13 | * @sig * -> Boolean
|
|---|
| 14 | * @param {*} val The value to test
|
|---|
| 15 | * @return {boolean}
|
|---|
| 16 | * @see {@link RA.isNotFloat|isNotFloat}
|
|---|
| 17 | * @example
|
|---|
| 18 | *
|
|---|
| 19 | * RA.isFloat(0); //=> false
|
|---|
| 20 | * RA.isFloat(1); //=> false
|
|---|
| 21 | * RA.isFloat(-100000); //=> false
|
|---|
| 22 | *
|
|---|
| 23 | * RA.isFloat(0.1); //=> true
|
|---|
| 24 | * RA.isFloat(Math.PI); //=> true
|
|---|
| 25 | *
|
|---|
| 26 | * RA.isFloat(NaN); //=> false
|
|---|
| 27 | * RA.isFloat(Infinity); //=> false
|
|---|
| 28 | * RA.isFloat(-Infinity); //=> false
|
|---|
| 29 | * RA.isFloat('10'); //=> false
|
|---|
| 30 | * RA.isFloat(true); //=> false
|
|---|
| 31 | * RA.isFloat(false); //=> false
|
|---|
| 32 | * RA.isFloat([1]); //=> false
|
|---|
| 33 | */
|
|---|
| 34 | const isFloat = both(isFinite, complement(isInteger));
|
|---|
| 35 |
|
|---|
| 36 | export default isFloat;
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.