forked from sheetjs/sheetjs
8 lines
215 B
JavaScript
8 lines
215 B
JavaScript
function commaify(s/*:string*/)/*:string*/ {
|
|
var w = 3;
|
|
if(s.length <= w) return s;
|
|
var j = (s.length % w), o = s.substr(0,j);
|
|
for(; j!=s.length; j+=w) o+=(o.length > 0 ? "," : "") + s.substr(j,w);
|
|
return o;
|
|
}
|