@jst_htet/comma-number
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

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"

/@jst_htet/comma-number/

    Package Sidebar

    Install

    npm i @jst_htet/comma-number

    Weekly Downloads

    6

    Version

    1.0.0

    License

    ISC

    Unpacked Size

    9.45 kB

    Total Files

    6

    Last publish

    Collaborators

    • jst_htet