2.0.1 • Published 1 year ago

@cstan/sep-k v2.0.1

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

sep-k

A CommonJS module that is a function that takes a numeric string or a number which it converts it to a string. It then adds a marker, a comma or period, every thousands place. The default marker is a comma but by using the optional second argument of the function the period will be used. See examples below. The second argument is boolean and false will use the period as a thousands marker.

Installation:

npm install @cstan/sep-k

Use:

const { sepK } = require("cstan/sep-k")

let n = "1234567.89";
// or let n = 1234567.89;

let s = sepK(n);
console.log(New string = ${s};)
// New string = 1,234,567.89

Also:

let n = "1234567,89";
// or let n = 1234567,89;

let s = sepK(n, false); // Note use of second argument to change marker.
console.log(New string = ${s};)
// New string = 1.234.567,89