humanify-numbers
v1.1.8
Published
Stringify numbers for humans. E.g. 2000 ➜ "2 Thousands"
Downloads
65
Readme
humanify-numbers
Stringify numbers for humans, aka Humanify the numbers.
E.g. 1234 ➜ "1.2K"
Install
npm install -s humanify-numbers
TypeScript Usage
Simple TypeScript code:
import { Numbers } from 'humanify-numbers'
console.log("1234567890 ➜", Numbers.stringify(1234567890))
// output: 1.2B
console.log("1234567890 ➜", Numbers.stringify(1234567890,
{ style: 'space' }))
// output: 1.1GiB
console.log("1234567890 ➜", (1234567890).toLocaleString())
// compare with toLocalString(): 1,234,567,890
JavaScript Usage
Same code in simple JavaScript:
const { Numbers } = require("humanify-numbers");
console.log("1234 ➜", Numbers.stringify(1234));
// output: 1234 ➜ 1.2K