UNPKG

@intlayer/core

Version:

Includes core Intlayer functions like translation, dictionary, and utility functions shared across multiple packages.

18 lines (16 loc) 578 B
import { getCachedIntl } from "../utils/intl.mjs"; import { internationalization } from "@intlayer/config/built"; //#region src/formatters/number.ts /** * Formats a numeric value using locale-aware formatting. * * @example * number(123456.789); // "123,456.789" * * @example * number("1000000", { locale: Locales.FRENCH }); // "1 000 000" */ const number = (value, { locale, ...options } = {}) => getCachedIntl(Intl.NumberFormat, locale ?? internationalization?.defaultLocale, options).format(Number(value)); //#endregion export { number }; //# sourceMappingURL=number.mjs.map