UNPKG

vanilla-type-check

Version:
17 lines (16 loc) 555 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var isArray_1 = require("./isArray"); /** * Check if a value is numeric. * Strings like `"123"` are considered numbers. * Note that `Infinity` is not a number. * * @param value value to check * @returns `true` if `obj` is a numeric value */ function isNumeric(value) { var realStringObj = value != null && value.toString(); return !isArray_1.isArray(value) && (realStringObj - parseFloat(realStringObj) + 1) >= 0; } exports.isNumeric = isNumeric;