The `isNumeric` package provides a utility function to determine if a given JavaScript object represents a numeric value. It's designed to be more permissive than standard JavaScript's `Number.isFinite()` or `isNaN()`, accepting various string representations of numbers, including integers, floating-points, octals (e.g., `0144`), hexadecimals (e.g., `0xFF`), and scientific notation (e.g., `3e5`). This package is currently at version 0.3.3 and was last published over 8 years ago, indicating it is no longer actively maintained. Its key differentiator is its broad interpretation of what constitutes a 'numeric' value, especially its handling of string inputs, which includes unusual parsing of 'decimal commas' (e.g., '1,1') that deviates from standard JavaScript number parsing. Given its abandonment, users might consider more modern, actively maintained alternatives or native `Number` methods for stricter validation.
npm install isnumericVerified import paths — ran on the pinned version, not inferred.
Demonstrates various numeric and non-numeric values, highlighting the package's broad interpretation of 'numeric' including string parsing and unique decimal comma handling.
Evaluate alternatives like `Number.isFinite()`, `parseFloat()`, `Number.isNaN()`, or well-maintained third-party libraries (`is-number` by jonschlinkert, or `lodash.isnumber` if using Lodash).
Be aware of this specific behavior. If standard JavaScript numeric parsing is required, avoid `isNumeric` or implement custom validation for such strings. Consider using `Number.parseFloat(value.replace(',', '.'))` for explicit decimal handling in locales that use commas for decimals.For Node.js environments, use `const isNumeric = require('isnumeric');`. For browser or modern ESM-only environments, a build step (e.g., Webpack, Rollup) might be required to bundle CJS modules, or preferably, migrate to an ESM-native alternative.Understand the full range of values that `isNumeric` considers true. If strict numerical validation or finite number checks are needed, combine `isNumeric` with `Number.isFinite()` or directly use `Number.isFinite(parseFloat(value))`.
For CommonJS modules in an ES module environment, you typically need to use `import { createRequire } from 'module'; const require = createRequire(import.meta.url); const isNumeric = require('isnumeric');` or migrate to an ESM-compatible library.If using ESM syntax, try importing as a default: `import isNumeric from 'isnumeric';`. If this still causes issues, or if in a CJS context, revert to `const isNumeric = require('isnumeric');`.No dependency data recorded yet.