lion/packages/localize/src/number/getGroupSeparator.js
Joren Broekema 09d9675963 feat(localize): add types to localize
Co-authored-by: narzac <narzac@gmail.com>
2020-08-03 17:00:26 +02:00

17 lines
481 B
JavaScript

import { getLocale } from './getLocale.js';
import { normalSpaces } from './normalSpaces.js';
/**
* Gets the group separator
*
* @param {string} [locale] To override the browser locale
* @returns {string}
*/
export function getGroupSeparator(locale) {
const computedLocale = getLocale(locale);
const formattedNumber = Intl.NumberFormat(computedLocale, {
style: 'decimal',
minimumFractionDigits: 0,
}).format(10000);
return normalSpaces(formattedNumber[2]);
}