UNPKG

thousand-separator

Version:
19 lines 550 B
// UMD Definitions (function(name, definition) { // NodeJS & CommonJS if (typeof exports !== 'undefined' && typeof module !== 'undefined') { module.exports = definition(); } // AMD else if (typeof define === 'function' && typeof define.amd === 'object') { define(definition); } // Browser Globals else { this[name] = definition(); } })('ThousandSeparator', function() { return function(x) { return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","); }; });