Registry / productivity / numerify

numerify

JSON →
library1.2.9jsnpmunverified

Numerify is a JavaScript number formatting library (version 1.2.9) that provides flexible formatting patterns similar to Numeral.js. It supports thousands separators, decimals, percentages, abbreviations (k/m/b/t), and custom rounding. The library is extensible via plugins (e.g., bytes, bps) and a registry for custom formats. It offers both ESM and CommonJS modules, and is actively maintained with weekly releases. Key differentiators include a minimal API surface, plugin architecture, and configurable options like zero/null formatting and abbreviation labels.

npm install numerify
INSTALL
IMPORT
SIG · NUMERIFY
N
numerify
productivityjavascriptv1.2.9
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

numerify
import numerify from 'numerify'
const numerify = require('numerify')
ESM default export. CommonJS users must import from 'numerify/lib/index.cjs.js'.
numerify (UMD)
<script src="https://unpkg.com/numerify/lib/index.umd.min.js"></script>
import numerify from 'numerify/lib/index.umd'
UMD build is for browser; do not import in Node/ESM.
numerifyBytes
import numerifyBytes from 'numerify/lib/plugins/bytes.umd.js'
import { bytes } from 'numerify'
Plugins are separate UMD files; register with numerify.register('bytes', numerifyBytes).

Demonstrates basic numeric formatting with separators, percentages, abbreviations, custom zero display, and a plugin registration (bytes).

import numerify from 'numerify'; console.log(numerify(1234567, '0,0')); // 1,234,567 console.log(numerify(0.974878234, '0.000%')); // 97.488% console.log(numerify(1230974, '0.0a')); // 1.2m numerify.setOptions({ zeroFormat: 'N/A' }); console.log(numerify(0, '0.0')); // N/A import numerifyBytes from 'numerify/lib/plugins/bytes.umd.js'; numerify.register('bytes', numerifyBytes); console.log(numerify(1024, '0b')); // 1KB
Debug
Known issues
gotchaCommonJS require must use the explicit CJS path: 'numerify/lib/index.cjs.js'
fix
Use 'require('numerify/lib/index.cjs.js')' instead of 'require('numerify')'.
affects: >=1.0.0
deprecatedUsing the UMD build in a bundler without proper webpack config may cause issues.
fix
Prefer the ESM import 'import numerify from 'numerify'' in bundlers.
affects: >=1.0.0
gotchaThe 'numerify.register' function expects a format object with 'regexp' and 'format' methods; incorrect implementation can cause errors.
fix
Ensure the registered object has a 'regexp' RegExp and a 'format(value, format, roundingFunction)' function.
affects: >=1.0.0
gotchaWhen using the bytes plugin, the format string must include 'b' (e.g., '0b'); otherwise, the plugin won't trigger.
fix
Use format like '0b' or '0.0b' for byte formatting.
affects: >=1.0.0
Errors
Common errors & fixes
Cannot find module 'numerify'
Node.js cannot resolve the ESM package without proper configuration, or the import path is wrong.
fix
For CommonJS: const numerify = require('numerify/lib/index.cjs.js'). For ESM: use 'import numerify from 'numerify'' and ensure package.json has 'type': 'module' or .mjs extension.
numerify is not a function
Default import was used incorrectly, likely because the import statement did not get the default export.
fix
Use import numerify from 'numerify' (default import) instead of import { numerify } from 'numerify'.
numerify(...) is not a function
The UMD bundle was not loaded properly or the global variable is undefined.
fix
Ensure the script tag points to 'numerify/lib/index.umd.min.js' and is loaded before usage.
Uncaught TypeError: Cannot read properties of undefined (reading 'options')
The numerify object is not initialized, likely because the plugin registration was attempted before loading numerify itself.
fix
Ensure numerify is imported/loaded before calling numerify.register() or numerify.setOptions().
Upgrade
Version history
1.2.9latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
13 hits · last 30 days
node
12
OpenAI (training)
1
Resources
numerify — npm install numerify · libregistry