UNPKG

vanilla-type-check

Version:
15 lines (14 loc) 471 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); /** * Check if a value is a number. * Note that Strings are NOT _numbers_ (even `"123"`. Use `isNumeric` for that) * and `Infinity` IS a _number_ in this case * * @param value value to check * @returns `true` if `obj` is a number */ function isNumber(value) { return !isNaN(value) && typeof value === 'number' || value instanceof Number; } exports.isNumber = isNumber;