Package Exports
- groupdigits
- groupdigits/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (groupdigits) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
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 groupdigits
Usage
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.