UNPKG

101

Version:

common javascript utils that can be required selectively that assume es5+

16 lines (13 loc) 360 B
/** * @module 101/is-number */ /** * Functional version of val typeof 'number' * @function module:101/is-number * @param {*} val - value checked to be a string * @return {boolean} Whether the value is an string or not */ module.exports = isNumber; function isNumber (val) { return (typeof val === 'number' || val instanceof Number) && !isNaN(val) }