groupdigits
v1.0.0
Published
money
Downloads
5
Readme
money
A lightweight utility function to format numeric strings by inserting separators (e.g., commas or dots) every n digits from the right. Useful for formatting numbers as currency or improving readability.
Installation
You can copy and use money.js directly in your Node.js project.
Or add it to your project manually:
# If published as a package (not yet available)
npm install groupdigitsUsage
const money = require('./money');
console.log(money("12000", 3)); // "12,000"
console.log(money("123456789", 3)); // "123,456,789"
console.log(money("123456789", 2)); // "1,23,45,67,89"
console.log(money("12000", 3, ".")); // "12.000"Paremeters
money(str,num,point?);README.md is written by AI. The code is written by human.
