UNPKG

ramda-adjunct

Version:

Ramda Adjunct is the most popular and most comprehensive set of utilities for use with Ramda, providing a variety of useful, well tested functions with excellent documentation.

35 lines (34 loc) 1.1 kB
import { bind, curryN } from 'ramda'; import isFunction from './isFunction'; import polyfill from './internal/polyfills/Number.isInteger'; export var isIntegerPolyfill = curryN(1, polyfill); /** * Checks whether the passed value is an `integer`. * * @func isInteger * @memberOf RA * @since {@link https://char0n.github.io/ramda-adjunct/0.7.0|v0.7.0} * @category Type * @sig * -> Boolean * @param {*} val The value to test * @return {boolean} * @see {@link RA.isNotInteger|isNotInteger} * @example * * RA.isInteger(0); //=> true * RA.isInteger(1); //=> true * RA.isInteger(-100000); //=> true * * RA.isInteger(0.1); //=> false * RA.isInteger(Math.PI); //=> false * * RA.isInteger(NaN); //=> false * RA.isInteger(Infinity); //=> false * RA.isInteger(-Infinity); //=> false * RA.isInteger('10'); //=> false * RA.isInteger(true); //=> false * RA.isInteger(false); //=> false * RA.isInteger([1]); //=> false */ var isInteger = isFunction(Number.isInteger) ? curryN(1, bind(Number.isInteger, Number)) : isIntegerPolyfill; export default isInteger;