MCPcopy
hub / github.com/tdewolff/minify / addCommas

Function addCommas

_benchmarks/sample_echarts.js:16432–16439  ·  view source on GitHub ↗

* Add a comma each three digit.

(x)

Source from the content-addressed store, hash-verified

16430 */
16431
16432 function addCommas(x) {
16433 if (!isNumeric(x)) {
16434 return isString(x) ? x : '-';
16435 }
16436
16437 var parts = (x + '').split('.');
16438 return parts[0].replace(/(\d{1,3})(?=(?:\d{3})+(?!\d))/g, '$1,') + (parts.length > 1 ? '.' + parts[1] : '');
16439 }
16440 function toCamelCase(str, upperCaseFirst) {
16441 str = (str || '').toLowerCase().replace(/-(.)/g, function (match, group1) {
16442 return group1.toUpperCase();

Callers 2

makeValueReadableFunction · 0.85
sample_echarts.jsFile · 0.85

Calls 2

isNumericFunction · 0.70
isStringFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…