1.0.1 • Published 4 years ago

to-digit-grouped v1.0.1

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

To Digit Grouped

build status npm package

Use thousand separator (or custom text) to group digits in a string.

import toDigitGrouped from 'to-digit-grouped';

toDigitGrouped('1234567890.1234567890');
// "1 234 567 890.1234567890"

toDigitGrouped('value: 1234567890.1234567890 unit');
// "value: 1 234 567 890.1234567890 unit"

toDigitGrouped('1234 and 5678');
// 1 234 and 4578

toDigitGrouped('1234 and 5678', { multiple: true });
// 1 234 and 4 578

toDigitGrouped('1234567890.1234567890');
// "1 234 567 890.1234567890"

toDigitGrouped('1234567890.1234567890', { groupFraction: true });
// "1 234 567 890.123 456 789 0"

toDigitGrouped('1234567890.1234567890', { groupSeparator: ',' });
// "1,234,567,890.1234567890"

toDigitGrouped('1234567890.1234567890', { groupSize: 4 });
// "12 3456 7890.1234567890"

toDigitGrouped('1234567890,1234567890', { decimalSeparator: ',' });
// "1 234 567 890,1234567890"

toDigitGrouped('0123456789abcdef', {
  digitCharacters: '0123456789abcdef',
  groupSize: 2,
});
// "01 23 45 67 89 ab cd ef"
1.0.1

4 years ago

1.0.0

4 years ago

0.1.0

4 years ago