UNPKG

ramda-extension

Version:

Helpful functions built on top of the mighty Ramda

30 lines (29 loc) 802 B
import { allPass, o } from 'ramda'; import notNaN from './notNaN'; /** * Returns true if argument is finite numeric value. * * @func * @category Logic * * @example * * R_.isNumeric(-1) // true * R_.isNumeric(0) // true * R_.isNumeric(1) // true * R_.isNumeric(1.1) // true * R_.isNumeric(Infinity) // false * R_.isNumeric(NaN) // false * R_.isNumeric('') // false * R_.isNumeric(() => {}) // false * R_.isNumeric(false) // false * R_.isNumeric(null) // false * R_.isNumeric(undefined) // false * R_.isNumeric({}) // false * R_.isNumeric([]) // false * * @sig a -> Boolean * */ var isNumeric = /*#__PURE__*/allPass([/*#__PURE__*/o(notNaN, parseFloat), isFinite]); export default isNumeric;