Humanity
Humanity is a library for humanizing data in a human-readable form.
How to use
import { createHumanity } from "https://deno.land/x/humanity/mod.ts";
const Humanity = createHumanity("en_US");
console.log(Humanity.number(500000)); // 500 000
// Output: 500 thousand
You can use custom language
import { createCustomHumanity } from "https://deno.land/x/humanity/mod.ts";
const Humanity = createCustomHumanity({
locale: "custom",
numbers: {
thousand: "th",
million: "m",
billion: "b",
trillion: "t",
quadrillion: "q",
quintillion: "qui",
},
});
console.log(Humanity.number(500000)); // 500 th
Supported languages by default
en_US
de_DE
ru_RU