shortscale
v4.1.2
Published
Convert positive integers to English words (ESM only)
Downloads
16
Readme
shortscale
Converts numbers into English words.
This module was written as an exploration of JavaScript and Rust documented here.
The short scale, has different words for each power of 1000.
Supports positive integers from 0 to Number.MAX_SAFE_INTEGER (9,007,199,254,740,991).
All other values return undefined.
Example
import { shortscale } from 'shortscale';
console.log(shortscale(420000999015));
// four hundred and twenty billion nine hundred and ninety nine thousand and fifteen
ESM
As of v2.0 , this library is packaged as an ESM module.
To call from CommonJS use dynamic import(), or use require() with version ^1.1.0
in package.json.
See example-CJS-v1, example-CJS-v2, example-ESM.
Rust
For Rust version see jldec/shortscale-rs.