ktongue's picture
download
raw
475 Bytes
export default function(grouping, thousands) {
return function(value, width) {
var i = value.length,
t = [],
j = 0,
g = grouping[0],
length = 0;
while (i > 0 && g > 0) {
if (length + g + 1 > width) g = Math.max(1, width - length);
t.push(value.substring(i -= g, i + g));
if ((length += g + 1) > width) break;
g = grouping[j = (j + 1) % grouping.length];
}
return t.reverse().join(thousands);
};
}

Xet Storage Details

Size:
475 Bytes
·
Xet hash:
62a98c5365b506f40b6dd166d4da0a2bf3b533ec9d44257001cfbd691011b630

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.