bingo-functional-js
Version:
A port of the PHP bingo-functional library
18 lines (15 loc) • 388 B
JavaScript
const isNumber = require('./isNumber')
const isString = require('./isString')
/**
* isNumeric function
* isNumeric :: String -> Int -> Bool
* @param {string} str
* @param {number} radix
* @returns {boolean}
* @example
*
* isNumeric('99b')
* // => true
*/
const isNumeric = (str, radix = 10) => isString(str) && isNumber(Number.parseInt(str, radix))
module.exports = isNumeric