1.0.2 ⢠Published 6 years ago
splaf v1.0.2
š Splaf
ā”ļø String format utility without Regex
$ npm i splaf --save
Usage
import splaf from "splaf";
// or
const splaf = require("splaf");
Or include it via jsDelivr CDN:
<script src="https://cdn.jsdelivr.net/npm/splaf@1.0.2/build/index.min.js"></script>
Methods & Examples
splaf('315576000') // '315,576,000'
splaf('315576000', 2 , ' ') // '3 15 57 60 00'
splaf('315576', 1 , '-') // '3-1-5-5-7-6'
Notes
- Works both in Node.js and in the browser.
- All pull requests are welcome, feel free.
License
MIT