@formatjs/intl-numberformat
Version:
Ponyfill for ES2020 Intl.NumberFormat
11 lines (10 loc) • 349 B
JavaScript
// eslint-disable-next-line import/no-cycle
import { NumberFormat } from './core';
/**
* Number.prototype.toLocaleString ponyfill
* https://tc39.es/ecma402/#sup-number.prototype.tolocalestring
*/
export function toLocaleString(x, locales, options) {
var numberFormat = new NumberFormat(locales, options);
return numberFormat.format(x);
}