UNPKG

@intlayer/core

Version:

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

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