source: node_modules/ramda-adjunct/es/isFloat.js@ d24f17c

main
Last change on this file since d24f17c was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago

Initial commit

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