Usage
Typescript support for commaNumber javascript package
// Commonjs
const commaNumber = require("comma-number");
// ES6
import commaNumber from "comma-number";
commaNumber(1000); // "1,000"
commaNumber(-1000); // "-1,000"
commaNumber(-1000, "."); // "-1.000"
commaNumber(1000.12); // "1,000.12"
commaNumber(-1000.12); // "-1,000.12"
commaNumber("-1000,12", ".", ","); // "-1.000,12"
// make a new function using custom separator and decimal char:
const format = commaNumber.bindWith("_", "!");
// use it as you would commaNumber().
format(1000); // "1_000"
format(-1000); // "-1_000"
format(1000.12); // "1_000!12"
format(-1000.12); // "-1_000!12"