Registry / devops / number-formatterznyak

number-formatterznyak

JSON →
library0.1.5jsnpmunverified

A lightweight utility for formatting numbers (e.g., adding thousands separators) built for Node.js >=4.2.4. Version 0.1.5 is the latest; no frequent updates since 2016. Simpler than Intl.NumberFormat but limited to basic formatting. No dependencies.

npm install number-formatterznyak
INSTALL
IMPORT
SIG · NUMBER-FORMATTERZN
N
number-formatterznyak
devopsjavascriptv0.1.5
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.

default
import nf from 'number-formatterznyak'
const nf = require('number-formatterznyak')
ES module default import works because the package has an ESM export. CommonJS require will break if the project is configured as ESM.
formatNumber
import { formatNumber } from 'number-formatterznyak'
import { formatNumber } from 'number-formatter'
The package name includes 'znyak'. The named export may not exist; prefer default import.
require
const nf = require('number-formatterznyak')
const nf = require('number-formatter')
CommonJS require works in Node.js <14 and when importing into a CommonJS module.

Shows the basic usage of formatting a number with commas as thousands separators using the default export.

import nf from 'number-formatterznyak'; const formatted = nf(1234567.89); console.log(formatted); // '1,234,567.89'
Debug
Known issues
gotchaPackage name is 'number-formatterznyak', not 'number-formatter'. Many people mistakenly try to import from the wrong name.
fix
Use 'number-formatterznyak' in package.json and all import/require statements.
affects: >=0.0.0
gotchaThe package has no TypeScript type definitions. Using with TypeScript requires a custom declaration file.
fix
Create a .d.ts file: declare module 'number-formatterznyak' { export default function nf(num: number): string; }
affects: >=0.0.0
deprecatedThis package is in maintenance mode with no updates since 2016. Not recommended for new projects; use Intl.NumberFormat for modern browser/Node environments.
fix
Replace with Intl.NumberFormat: new Intl.NumberFormat('en-US').format(1234567.89) // '1,234,567.89'
affects: >=0.0.0
gotchaThe function may not handle very large numbers or scientific notation correctly due to JavaScript number precision.
fix
For large numbers, consider using a library like 'format-number' or converting to string first.
affects: >=0.0.0
Errors
Common errors & fixes
Error: Cannot find module 'number-formatter'
Trying to import/require from the wrong package name.
fix
Change to require('number-formatterznyak') or import from 'number-formatterznyak'.
TypeError: nf is not a function
Using default import incorrectly, e.g., import { formatNumber } from 'number-formatterznyak' when the package only exports a single function as default.
fix
Use import nf from 'number-formatterznyak' and then call nf(1234).
Upgrade
Version history
0.1.5latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
number-formatterznyak — npm install number-formatterznyak · libregistry