source: node_modules/ramda-adjunct/src/isFloat.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: 943 bytes
RevLine 
[d24f17c]1import { complement, both } from 'ramda';
2
3import isInteger from './isInteger';
4import 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 */
34const isFloat = both(isFinite, complement(isInteger));
35
36export default isFloat;
Note: See TracBrowser for help on using the repository browser.