@intlayer/core 5.8.0-canary.0 → 5.8.1-canary.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/formatters/compact.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport { LocalesValues } from '@intlayer/config/client';\nimport { Intl } from '../utils/intl';\n\n/**\n * Formats a numeric value using compact notation (e.g., 1K, 1M, 1B)\n * based on locale and formatting options.\n *\n * @example\n * compact({ value: 1200 }); // \"1.2K\"\n *\n * @example\n * compact({ value: \"1000000\", locale: Locales.FRENCH, compactDisplay: \"long\" });\n * // \"1 million\"\n */\nexport const compact = (\n value: string | number,\n options?: Intl.NumberFormatOptions & { locale?: LocalesValues }\n): string =>\n new Intl.NumberFormat(\n options?.locale ?? configuration.internationalization.defaultLocale,\n {\n ...options,\n notation: 'compact',\n }\n ).format(Number(value));\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA0B;AAE1B,kBAAqB;AAad,MAAM,UAAU,CACrB,OACA,YAEA,IAAI,iBAAK;AAAA,EACP,SAAS,UAAU,aAAAA,QAAc,qBAAqB;AAAA,EACtD;AAAA,IACE,GAAG;AAAA,IACH,UAAU;AAAA,EACZ;AACF,EAAE,OAAO,OAAO,KAAK,CAAC;","names":["configuration"]}
1
+ {"version":3,"sources":["../../../src/formatters/compact.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport { LocalesValues } from '@intlayer/config/client';\nimport { Intl as CachedIntl } from '../utils/intl';\n\n/**\n * Formats a numeric value using compact notation (e.g., 1K, 1M, 1B)\n * based on locale and formatting options.\n *\n * @example\n * compact({ value: 1200 }); // \"1.2K\"\n *\n * @example\n * compact({ value: \"1000000\", locale: Locales.FRENCH, compactDisplay: \"long\" });\n * // \"1 million\"\n */\nexport const compact = (\n value: string | number,\n options?: Intl.NumberFormatOptions & { locale?: LocalesValues }\n): string =>\n new CachedIntl.NumberFormat(\n options?.locale ?? configuration.internationalization.defaultLocale,\n {\n ...options,\n notation: 'compact',\n }\n ).format(Number(value));\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA0B;AAE1B,kBAAmC;AAa5B,MAAM,UAAU,CACrB,OACA,YAEA,IAAI,YAAAA,KAAW;AAAA,EACb,SAAS,UAAU,aAAAC,QAAc,qBAAqB;AAAA,EACtD;AAAA,IACE,GAAG;AAAA,IACH,UAAU;AAAA,EACZ;AACF,EAAE,OAAO,OAAO,KAAK,CAAC;","names":["CachedIntl","configuration"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/formatters/currency.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport { type LocalesValues } from '@intlayer/config/client';\nimport { Intl } from '../utils/intl';\n\n/**\n * Formats a numeric or string value into a localized currency string using the Intl API.\n *\n * @example\n * currency({ value: 1234.5, currency: 'EUR' });\n * // \"€1,234.50\"\n *\n * @example\n * currency({ value: \"5000\", locale: Locales.FRENCH, currency: \"CAD\", currencyDisplay: \"code\" });\n * // \"5 000,00 CAD\"\n */\nexport const currency = (\n value: string | number,\n options?: Intl.NumberFormatOptions & { locale?: LocalesValues }\n): string =>\n new Intl.NumberFormat(\n options?.locale ?? configuration.internationalization.defaultLocale,\n {\n style: 'currency',\n currency: options?.currency ?? 'USD',\n currencyDisplay: options?.currencyDisplay ?? 'symbol',\n minimumFractionDigits: options?.minimumFractionDigits ?? 2,\n maximumFractionDigits: options?.maximumFractionDigits ?? 2,\n ...options,\n }\n ).format(Number(value));\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA0B;AAE1B,kBAAqB;AAad,MAAM,WAAW,CACtB,OACA,YAEA,IAAI,iBAAK;AAAA,EACP,SAAS,UAAU,aAAAA,QAAc,qBAAqB;AAAA,EACtD;AAAA,IACE,OAAO;AAAA,IACP,UAAU,SAAS,YAAY;AAAA,IAC/B,iBAAiB,SAAS,mBAAmB;AAAA,IAC7C,uBAAuB,SAAS,yBAAyB;AAAA,IACzD,uBAAuB,SAAS,yBAAyB;AAAA,IACzD,GAAG;AAAA,EACL;AACF,EAAE,OAAO,OAAO,KAAK,CAAC;","names":["configuration"]}
1
+ {"version":3,"sources":["../../../src/formatters/currency.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport { type LocalesValues } from '@intlayer/config/client';\nimport { Intl as CachedIntl } from '../utils/intl';\n\n/**\n * Formats a numeric or string value into a localized currency string using the Intl API.\n *\n * @example\n * currency({ value: 1234.5, currency: 'EUR' });\n * // \"€1,234.50\"\n *\n * @example\n * currency({ value: \"5000\", locale: Locales.FRENCH, currency: \"CAD\", currencyDisplay: \"code\" });\n * // \"5 000,00 CAD\"\n */\nexport const currency = (\n value: string | number,\n options?: Intl.NumberFormatOptions & { locale?: LocalesValues }\n): string =>\n new CachedIntl.NumberFormat(\n options?.locale ?? configuration.internationalization.defaultLocale,\n {\n style: 'currency',\n currency: options?.currency ?? 'USD',\n currencyDisplay: options?.currencyDisplay ?? 'symbol',\n minimumFractionDigits: options?.minimumFractionDigits ?? 2,\n maximumFractionDigits: options?.maximumFractionDigits ?? 2,\n ...options,\n }\n ).format(Number(value));\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA0B;AAE1B,kBAAmC;AAa5B,MAAM,WAAW,CACtB,OACA,YAEA,IAAI,YAAAA,KAAW;AAAA,EACb,SAAS,UAAU,aAAAC,QAAc,qBAAqB;AAAA,EACtD;AAAA,IACE,OAAO;AAAA,IACP,UAAU,SAAS,YAAY;AAAA,IAC/B,iBAAiB,SAAS,mBAAmB;AAAA,IAC7C,uBAAuB,SAAS,yBAAyB;AAAA,IACzD,uBAAuB,SAAS,yBAAyB;AAAA,IACzD,GAAG;AAAA,EACL;AACF,EAAE,OAAO,OAAO,KAAK,CAAC;","names":["CachedIntl","configuration"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/formatters/date.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport { type LocalesValues } from '@intlayer/config/client';\nimport { Intl } from '../utils/intl';\n\ntype DateTimePreset = 'short' | 'long' | 'dateOnly' | 'timeOnly' | 'full';\n\nconst presets: Record<DateTimePreset, Intl.DateTimeFormatOptions> = {\n short: {\n year: '2-digit',\n month: '2-digit',\n day: '2-digit',\n hour: '2-digit',\n minute: '2-digit',\n },\n long: {\n year: 'numeric',\n month: 'long',\n day: 'numeric',\n hour: 'numeric',\n minute: 'numeric',\n },\n full: {\n year: 'numeric',\n month: 'long',\n day: 'numeric',\n hour: 'numeric',\n minute: 'numeric',\n hour12: false,\n },\n dateOnly: {\n year: 'numeric',\n month: 'short',\n day: 'numeric',\n },\n timeOnly: {\n hour: 'numeric',\n minute: 'numeric',\n second: 'numeric',\n },\n};\n\n/**\n * Formats a date/time value into a localized string using Intl.DateTimeFormat.\n *\n * @example\n * date({ date: new Date(), options: \"short\" });\n * // \"08/02/25, 14:30\"\n *\n * @example\n * date({ date: \"2025-08-02T14:30:00Z\", locale: Locales.FRENCH, options: { month: \"long\", day: \"numeric\" } });\n * // \"2 août\"\n */\nexport const date = (\n date: Date | string | number,\n options?: Intl.DateTimeFormatOptions & { locale?: LocalesValues }\n): string => {\n const dateTime = new Date(date);\n\n const resolvedOptions =\n typeof options === 'string' ? (presets[options] ?? {}) : options;\n\n const formatter = new Intl.DateTimeFormat(\n options?.locale ?? configuration.internationalization.defaultLocale,\n resolvedOptions\n );\n\n return formatter.format(dateTime);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA0B;AAE1B,kBAAqB;AAIrB,MAAM,UAA8D;AAAA,EAClE,OAAO;AAAA,IACL,MAAM;AAAA,IACN,OAAO;AAAA,IACP,KAAK;AAAA,IACL,MAAM;AAAA,IACN,QAAQ;AAAA,EACV;AAAA,EACA,MAAM;AAAA,IACJ,MAAM;AAAA,IACN,OAAO;AAAA,IACP,KAAK;AAAA,IACL,MAAM;AAAA,IACN,QAAQ;AAAA,EACV;AAAA,EACA,MAAM;AAAA,IACJ,MAAM;AAAA,IACN,OAAO;AAAA,IACP,KAAK;AAAA,IACL,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,QAAQ;AAAA,EACV;AAAA,EACA,UAAU;AAAA,IACR,MAAM;AAAA,IACN,OAAO;AAAA,IACP,KAAK;AAAA,EACP;AAAA,EACA,UAAU;AAAA,IACR,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,QAAQ;AAAA,EACV;AACF;AAaO,MAAM,OAAO,CAClBA,OACA,YACW;AACX,QAAM,WAAW,IAAI,KAAKA,KAAI;AAE9B,QAAM,kBACJ,OAAO,YAAY,WAAY,QAAQ,OAAO,KAAK,CAAC,IAAK;AAE3D,QAAM,YAAY,IAAI,iBAAK;AAAA,IACzB,SAAS,UAAU,aAAAC,QAAc,qBAAqB;AAAA,IACtD;AAAA,EACF;AAEA,SAAO,UAAU,OAAO,QAAQ;AAClC;","names":["date","configuration"]}
1
+ {"version":3,"sources":["../../../src/formatters/date.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport { type LocalesValues } from '@intlayer/config/client';\nimport { Intl as CachedIntl } from '../utils/intl';\n\ntype DateTimePreset = 'short' | 'long' | 'dateOnly' | 'timeOnly' | 'full';\n\nconst presets: Record<DateTimePreset, Intl.DateTimeFormatOptions> = {\n short: {\n year: '2-digit',\n month: '2-digit',\n day: '2-digit',\n hour: '2-digit',\n minute: '2-digit',\n },\n long: {\n year: 'numeric',\n month: 'long',\n day: 'numeric',\n hour: 'numeric',\n minute: 'numeric',\n },\n full: {\n year: 'numeric',\n month: 'long',\n day: 'numeric',\n hour: 'numeric',\n minute: 'numeric',\n hour12: false,\n },\n dateOnly: {\n year: 'numeric',\n month: 'short',\n day: 'numeric',\n },\n timeOnly: {\n hour: 'numeric',\n minute: 'numeric',\n second: 'numeric',\n },\n};\n\n/**\n * Formats a date/time value into a localized string using Intl.DateTimeFormat.\n *\n * @example\n * date({ date: new Date(), options: \"short\" });\n * // \"08/02/25, 14:30\"\n *\n * @example\n * date({ date: \"2025-08-02T14:30:00Z\", locale: Locales.FRENCH, options: { month: \"long\", day: \"numeric\" } });\n * // \"2 août\"\n */\nexport const date = (\n date: Date | string | number,\n options?: Intl.DateTimeFormatOptions & { locale?: LocalesValues }\n): string => {\n const dateTime = new Date(date);\n\n const resolvedOptions =\n typeof options === 'string' ? (presets[options] ?? {}) : options;\n\n const formatter = new CachedIntl.DateTimeFormat(\n options?.locale ?? configuration.internationalization.defaultLocale,\n resolvedOptions\n );\n\n return formatter.format(dateTime);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA0B;AAE1B,kBAAmC;AAInC,MAAM,UAA8D;AAAA,EAClE,OAAO;AAAA,IACL,MAAM;AAAA,IACN,OAAO;AAAA,IACP,KAAK;AAAA,IACL,MAAM;AAAA,IACN,QAAQ;AAAA,EACV;AAAA,EACA,MAAM;AAAA,IACJ,MAAM;AAAA,IACN,OAAO;AAAA,IACP,KAAK;AAAA,IACL,MAAM;AAAA,IACN,QAAQ;AAAA,EACV;AAAA,EACA,MAAM;AAAA,IACJ,MAAM;AAAA,IACN,OAAO;AAAA,IACP,KAAK;AAAA,IACL,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,QAAQ;AAAA,EACV;AAAA,EACA,UAAU;AAAA,IACR,MAAM;AAAA,IACN,OAAO;AAAA,IACP,KAAK;AAAA,EACP;AAAA,EACA,UAAU;AAAA,IACR,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,QAAQ;AAAA,EACV;AACF;AAaO,MAAM,OAAO,CAClBA,OACA,YACW;AACX,QAAM,WAAW,IAAI,KAAKA,KAAI;AAE9B,QAAM,kBACJ,OAAO,YAAY,WAAY,QAAQ,OAAO,KAAK,CAAC,IAAK;AAE3D,QAAM,YAAY,IAAI,YAAAC,KAAW;AAAA,IAC/B,SAAS,UAAU,aAAAC,QAAc,qBAAqB;AAAA,IACtD;AAAA,EACF;AAEA,SAAO,UAAU,OAAO,QAAQ;AAClC;","names":["date","CachedIntl","configuration"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/formatters/list.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport { type LocalesValues } from '@intlayer/config/client';\nimport { Intl } from '../utils/intl';\n\n/**\n * Formats an array of values into a localized list string using the Intl API.\n *\n * @example\n * list(['apple', 'banana', 'orange']);\n * // \"apple, banana, and orange\"\n *\n * @example\n * list(['red', 'green', 'blue'], { locale: Locales.FRENCH, type: 'disjunction' });\n * // \"rouge, vert ou bleu\"\n *\n * @example\n * list([1, 2, 3], { type: 'unit' });\n * // \"1, 2, 3\"\n */\nexport const list = (\n values: (string | number)[],\n options?: Intl.ListFormatOptions & { locale?: LocalesValues }\n): string =>\n new Intl.ListFormat(\n options?.locale ?? configuration.internationalization.defaultLocale,\n {\n type: options?.type ?? 'conjunction',\n style: options?.style ?? 'long',\n ...options,\n }\n ).format(values.map(String));\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA0B;AAE1B,kBAAqB;AAiBd,MAAM,OAAO,CAClB,QACA,YAEA,IAAI,iBAAK;AAAA,EACP,SAAS,UAAU,aAAAA,QAAc,qBAAqB;AAAA,EACtD;AAAA,IACE,MAAM,SAAS,QAAQ;AAAA,IACvB,OAAO,SAAS,SAAS;AAAA,IACzB,GAAG;AAAA,EACL;AACF,EAAE,OAAO,OAAO,IAAI,MAAM,CAAC;","names":["configuration"]}
1
+ {"version":3,"sources":["../../../src/formatters/list.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport { type LocalesValues } from '@intlayer/config/client';\nimport { Intl as CachedIntl } from '../utils/intl';\n\n/**\n * Formats an array of values into a localized list string using the Intl API.\n *\n * @example\n * list(['apple', 'banana', 'orange']);\n * // \"apple, banana, and orange\"\n *\n * @example\n * list(['red', 'green', 'blue'], { locale: Locales.FRENCH, type: 'disjunction' });\n * // \"rouge, vert ou bleu\"\n *\n * @example\n * list([1, 2, 3], { type: 'unit' });\n * // \"1, 2, 3\"\n */\nexport const list = (\n values: (string | number)[],\n options?: Intl.ListFormatOptions & { locale?: LocalesValues }\n): string =>\n new CachedIntl.ListFormat(\n options?.locale ?? configuration.internationalization.defaultLocale,\n {\n type: options?.type ?? 'conjunction',\n style: options?.style ?? 'long',\n ...options,\n }\n ).format(values.map(String));\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA0B;AAE1B,kBAAmC;AAiB5B,MAAM,OAAO,CAClB,QACA,YAEA,IAAI,YAAAA,KAAW;AAAA,EACb,SAAS,UAAU,aAAAC,QAAc,qBAAqB;AAAA,EACtD;AAAA,IACE,MAAM,SAAS,QAAQ;AAAA,IACvB,OAAO,SAAS,SAAS;AAAA,IACzB,GAAG;AAAA,EACL;AACF,EAAE,OAAO,OAAO,IAAI,MAAM,CAAC;","names":["CachedIntl","configuration"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/formatters/number.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport { type LocalesValues } from '@intlayer/config/client';\nimport { Intl } from '../utils/intl';\n\n/**\n * Formats a numeric value using locale-aware formatting.\n *\n * @example\n * number({ value: 123456.789 }); // \"123,456.789\"\n * number({ value: \"1000000\", locale: Locales.FRENCH }); // \"1 000 000\"\n */\nexport const number = (\n value: string | number,\n options?: Intl.NumberFormatOptions & { locale?: LocalesValues }\n): string =>\n new Intl.NumberFormat(\n options?.locale ?? configuration.internationalization.defaultLocale,\n options\n ).format(Number(value));\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA0B;AAE1B,kBAAqB;AASd,MAAM,SAAS,CACpB,OACA,YAEA,IAAI,iBAAK;AAAA,EACP,SAAS,UAAU,aAAAA,QAAc,qBAAqB;AAAA,EACtD;AACF,EAAE,OAAO,OAAO,KAAK,CAAC;","names":["configuration"]}
1
+ {"version":3,"sources":["../../../src/formatters/number.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport { type LocalesValues } from '@intlayer/config/client';\nimport { Intl as CachedIntl } from '../utils/intl';\n\n/**\n * Formats a numeric value using locale-aware formatting.\n *\n * @example\n * number({ value: 123456.789 }); // \"123,456.789\"\n * number({ value: \"1000000\", locale: Locales.FRENCH }); // \"1 000 000\"\n */\nexport const number = (\n value: string | number,\n options?: Intl.NumberFormatOptions & { locale?: LocalesValues }\n): string =>\n new CachedIntl.NumberFormat(\n options?.locale ?? configuration.internationalization.defaultLocale,\n options\n ).format(Number(value));\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA0B;AAE1B,kBAAmC;AAS5B,MAAM,SAAS,CACpB,OACA,YAEA,IAAI,YAAAA,KAAW;AAAA,EACb,SAAS,UAAU,aAAAC,QAAc,qBAAqB;AAAA,EACtD;AACF,EAAE,OAAO,OAAO,KAAK,CAAC;","names":["CachedIntl","configuration"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/formatters/percentage.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport { type LocalesValues } from '@intlayer/config/client';\nimport { Intl } from '../utils/intl';\n\n/**\n * Formats a number as a percentage string (e.g., 0.25 → \"25%\").\n *\n * @example\n * percentage({ value: 0.25 }) // \"25%\"\n * percentage({ value: 0.25, minimumFractionDigits: 2 }) // \"25.00%\"\n */\nexport const percentage = (\n value: string | number,\n options?: Intl.NumberFormatOptions & { locale?: LocalesValues }\n): string => {\n let numericValue = Number(value);\n\n // Normalize: if user passes 10, treat it as 10% instead of 1000%\n if (numericValue > 1) {\n numericValue = numericValue / 100;\n }\n\n const formatter = new Intl.NumberFormat(\n options?.locale ?? configuration.internationalization.defaultLocale,\n {\n style: 'percent',\n ...options,\n }\n );\n\n return formatter.format(Number(numericValue));\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA0B;AAE1B,kBAAqB;AASd,MAAM,aAAa,CACxB,OACA,YACW;AACX,MAAI,eAAe,OAAO,KAAK;AAG/B,MAAI,eAAe,GAAG;AACpB,mBAAe,eAAe;AAAA,EAChC;AAEA,QAAM,YAAY,IAAI,iBAAK;AAAA,IACzB,SAAS,UAAU,aAAAA,QAAc,qBAAqB;AAAA,IACtD;AAAA,MACE,OAAO;AAAA,MACP,GAAG;AAAA,IACL;AAAA,EACF;AAEA,SAAO,UAAU,OAAO,OAAO,YAAY,CAAC;AAC9C;","names":["configuration"]}
1
+ {"version":3,"sources":["../../../src/formatters/percentage.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport { type LocalesValues } from '@intlayer/config/client';\nimport { Intl as CachedIntl } from '../utils/intl';\n\n/**\n * Formats a number as a percentage string (e.g., 0.25 → \"25%\").\n *\n * @example\n * percentage({ value: 0.25 }) // \"25%\"\n * percentage({ value: 0.25, minimumFractionDigits: 2 }) // \"25.00%\"\n */\nexport const percentage = (\n value: string | number,\n options?: Intl.NumberFormatOptions & { locale?: LocalesValues }\n): string => {\n let numericValue = Number(value);\n\n // Normalize: if user passes 10, treat it as 10% instead of 1000%\n if (numericValue > 1) {\n numericValue = numericValue / 100;\n }\n\n const formatter = new CachedIntl.NumberFormat(\n options?.locale ?? configuration.internationalization.defaultLocale,\n {\n style: 'percent',\n ...options,\n }\n );\n\n return formatter.format(Number(numericValue));\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA0B;AAE1B,kBAAmC;AAS5B,MAAM,aAAa,CACxB,OACA,YACW;AACX,MAAI,eAAe,OAAO,KAAK;AAG/B,MAAI,eAAe,GAAG;AACpB,mBAAe,eAAe;AAAA,EAChC;AAEA,QAAM,YAAY,IAAI,YAAAA,KAAW;AAAA,IAC/B,SAAS,UAAU,aAAAC,QAAc,qBAAqB;AAAA,IACtD;AAAA,MACE,OAAO;AAAA,MACP,GAAG;AAAA,IACL;AAAA,EACF;AAEA,SAAO,UAAU,OAAO,OAAO,YAAY,CAAC;AAC9C;","names":["CachedIntl","configuration"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/formatters/relativeTime.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport { type LocalesValues } from '@intlayer/config/client';\nimport { Intl } from '../utils/intl';\n\ntype RelativeTimeUnit = Intl.RelativeTimeFormatUnit;\n\n/**\n * Calculate the difference between 2 dates in the given unit.\n */\nconst diffInUnit = (from: Date, to: Date, unit: RelativeTimeUnit): number => {\n const msDiff = to.getTime() - from.getTime();\n const sec = msDiff / 1000;\n\n switch (unit) {\n case 'second':\n return sec;\n case 'minute':\n return sec / 60;\n case 'hour':\n return sec / 3600;\n case 'day':\n return sec / 86400;\n case 'month':\n return sec / (30 * 86400); // approx\n case 'quarter':\n return sec / (3 * 30 * 86400); // 3 months approx\n case 'year':\n return sec / (365 * 86400); // approx\n default:\n return sec;\n }\n};\n\nexport const relativeTime = (\n from: Date | string | number,\n to: Date | string | number = new Date(),\n options?: Intl.RelativeTimeFormatOptions & {\n locale?: LocalesValues;\n unit?: RelativeTimeUnit;\n }\n): string => {\n const fromDate = new Date(from);\n const toDate = new Date(to);\n const unit = options?.unit ?? 'second';\n\n const value = diffInUnit(fromDate, toDate, unit);\n\n return new Intl.RelativeTimeFormat(\n options?.locale ?? configuration.internationalization.defaultLocale,\n options\n ).format(Math.round(value), unit);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA0B;AAE1B,kBAAqB;AAOrB,MAAM,aAAa,CAAC,MAAY,IAAU,SAAmC;AAC3E,QAAM,SAAS,GAAG,QAAQ,IAAI,KAAK,QAAQ;AAC3C,QAAM,MAAM,SAAS;AAErB,UAAQ,MAAM;AAAA,IACZ,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO,MAAM;AAAA,IACf,KAAK;AACH,aAAO,MAAM;AAAA,IACf,KAAK;AACH,aAAO,MAAM;AAAA,IACf,KAAK;AACH,aAAO,OAAO,KAAK;AAAA;AAAA,IACrB,KAAK;AACH,aAAO,OAAO,IAAI,KAAK;AAAA;AAAA,IACzB,KAAK;AACH,aAAO,OAAO,MAAM;AAAA;AAAA,IACtB;AACE,aAAO;AAAA,EACX;AACF;AAEO,MAAM,eAAe,CAC1B,MACA,KAA6B,oBAAI,KAAK,GACtC,YAIW;AACX,QAAM,WAAW,IAAI,KAAK,IAAI;AAC9B,QAAM,SAAS,IAAI,KAAK,EAAE;AAC1B,QAAM,OAAO,SAAS,QAAQ;AAE9B,QAAM,QAAQ,WAAW,UAAU,QAAQ,IAAI;AAE/C,SAAO,IAAI,iBAAK;AAAA,IACd,SAAS,UAAU,aAAAA,QAAc,qBAAqB;AAAA,IACtD;AAAA,EACF,EAAE,OAAO,KAAK,MAAM,KAAK,GAAG,IAAI;AAClC;","names":["configuration"]}
1
+ {"version":3,"sources":["../../../src/formatters/relativeTime.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport { type LocalesValues } from '@intlayer/config/client';\nimport { Intl as CachedIntl } from '../utils/intl';\n\ntype RelativeTimeUnit = Intl.RelativeTimeFormatUnit;\n\n/**\n * Calculate the difference between 2 dates in the given unit.\n */\nconst diffInUnit = (from: Date, to: Date, unit: RelativeTimeUnit): number => {\n const msDiff = to.getTime() - from.getTime();\n const sec = msDiff / 1000;\n\n switch (unit) {\n case 'second':\n return sec;\n case 'minute':\n return sec / 60;\n case 'hour':\n return sec / 3600;\n case 'day':\n return sec / 86400;\n case 'month':\n return sec / (30 * 86400); // approx\n case 'quarter':\n return sec / (3 * 30 * 86400); // 3 months approx\n case 'year':\n return sec / (365 * 86400); // approx\n default:\n return sec;\n }\n};\n\nexport const relativeTime = (\n from: Date | string | number,\n to: Date | string | number = new Date(),\n options?: Intl.RelativeTimeFormatOptions & {\n locale?: LocalesValues;\n unit?: RelativeTimeUnit;\n }\n): string => {\n const fromDate = new Date(from);\n const toDate = new Date(to);\n const unit = options?.unit ?? 'second';\n\n const value = diffInUnit(fromDate, toDate, unit);\n\n return new CachedIntl.RelativeTimeFormat(\n options?.locale ?? configuration.internationalization.defaultLocale,\n options\n ).format(Math.round(value), unit);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA0B;AAE1B,kBAAmC;AAOnC,MAAM,aAAa,CAAC,MAAY,IAAU,SAAmC;AAC3E,QAAM,SAAS,GAAG,QAAQ,IAAI,KAAK,QAAQ;AAC3C,QAAM,MAAM,SAAS;AAErB,UAAQ,MAAM;AAAA,IACZ,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO,MAAM;AAAA,IACf,KAAK;AACH,aAAO,MAAM;AAAA,IACf,KAAK;AACH,aAAO,MAAM;AAAA,IACf,KAAK;AACH,aAAO,OAAO,KAAK;AAAA;AAAA,IACrB,KAAK;AACH,aAAO,OAAO,IAAI,KAAK;AAAA;AAAA,IACzB,KAAK;AACH,aAAO,OAAO,MAAM;AAAA;AAAA,IACtB;AACE,aAAO;AAAA,EACX;AACF;AAEO,MAAM,eAAe,CAC1B,MACA,KAA6B,oBAAI,KAAK,GACtC,YAIW;AACX,QAAM,WAAW,IAAI,KAAK,IAAI;AAC9B,QAAM,SAAS,IAAI,KAAK,EAAE;AAC1B,QAAM,OAAO,SAAS,QAAQ;AAE9B,QAAM,QAAQ,WAAW,UAAU,QAAQ,IAAI;AAE/C,SAAO,IAAI,YAAAA,KAAW;AAAA,IACpB,SAAS,UAAU,aAAAC,QAAc,qBAAqB;AAAA,IACtD;AAAA,EACF,EAAE,OAAO,KAAK,MAAM,KAAK,GAAG,IAAI;AAClC;","names":["CachedIntl","configuration"]}
@@ -34,12 +34,12 @@ module.exports = __toCommonJS(units_exports);
34
34
  var import_built = __toESM(require("@intlayer/config/built"));
35
35
  var import_intl = require('../utils/intl.cjs');
36
36
  const units = (value, options) => new import_intl.Intl.NumberFormat(
37
- options.locale ?? import_built.default.internationalization.defaultLocale,
37
+ options?.locale ?? import_built.default.internationalization.defaultLocale,
38
38
  {
39
39
  style: "unit",
40
- unit: options.unit ?? "day",
41
- unitDisplay: options.unitDisplay ?? "short",
42
- useGrouping: options.useGrouping ?? false
40
+ unit: options?.unit ?? "day",
41
+ unitDisplay: options?.unitDisplay ?? "short",
42
+ useGrouping: options?.useGrouping ?? false
43
43
  }
44
44
  ).format(Number(value));
45
45
  // Annotate the CommonJS export names for ESM import in node:
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/formatters/units.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport { type LocalesValues } from '@intlayer/config/client';\nimport { Intl } from '../utils/intl';\n\n/**\n * Formats a numeric value as a localized unit string.\n *\n * @example\n * units({ value: 5, unit: \"kilometer\", unitDisplay: \"long\", locale: \"en-GB\" })\n * // \"5 kilometers\"\n */\nexport const units = (\n value: number | string,\n options?: Intl.NumberFormatOptions & { locale?: LocalesValues }\n): string =>\n new Intl.NumberFormat(\n options.locale ?? configuration.internationalization.defaultLocale,\n {\n style: 'unit',\n unit: options.unit ?? 'day',\n unitDisplay: options.unitDisplay ?? 'short',\n useGrouping: options.useGrouping ?? false,\n }\n ).format(Number(value));\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA0B;AAE1B,kBAAqB;AASd,MAAM,QAAQ,CACnB,OACA,YAEA,IAAI,iBAAK;AAAA,EACP,QAAQ,UAAU,aAAAA,QAAc,qBAAqB;AAAA,EACrD;AAAA,IACE,OAAO;AAAA,IACP,MAAM,QAAQ,QAAQ;AAAA,IACtB,aAAa,QAAQ,eAAe;AAAA,IACpC,aAAa,QAAQ,eAAe;AAAA,EACtC;AACF,EAAE,OAAO,OAAO,KAAK,CAAC;","names":["configuration"]}
1
+ {"version":3,"sources":["../../../src/formatters/units.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport { type LocalesValues } from '@intlayer/config/client';\nimport { Intl as CachedIntl } from '../utils/intl';\n\n/**\n * Formats a numeric value as a localized unit string.\n *\n * @example\n * units({ value: 5, unit: \"kilometer\", unitDisplay: \"long\", locale: \"en-GB\" })\n * // \"5 kilometers\"\n */\nexport const units = (\n value: number | string,\n options?: Intl.NumberFormatOptions & { locale?: LocalesValues }\n): string =>\n new CachedIntl.NumberFormat(\n options?.locale ?? configuration.internationalization.defaultLocale,\n {\n style: 'unit',\n unit: options?.unit ?? 'day',\n unitDisplay: options?.unitDisplay ?? 'short',\n useGrouping: options?.useGrouping ?? false,\n }\n ).format(Number(value));\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA0B;AAE1B,kBAAmC;AAS5B,MAAM,QAAQ,CACnB,OACA,YAEA,IAAI,YAAAA,KAAW;AAAA,EACb,SAAS,UAAU,aAAAC,QAAc,qBAAqB;AAAA,EACtD;AAAA,IACE,OAAO;AAAA,IACP,MAAM,SAAS,QAAQ;AAAA,IACvB,aAAa,SAAS,eAAe;AAAA,IACrC,aAAa,SAAS,eAAe;AAAA,EACvC;AACF,EAAE,OAAO,OAAO,KAAK,CAAC;","names":["CachedIntl","configuration"]}
@@ -1,6 +1,6 @@
1
1
  import configuration from "@intlayer/config/built";
2
- import { Intl } from "../utils/intl.mjs";
3
- const compact = (value, options) => new Intl.NumberFormat(
2
+ import { Intl as CachedIntl } from "../utils/intl.mjs";
3
+ const compact = (value, options) => new CachedIntl.NumberFormat(
4
4
  options?.locale ?? configuration.internationalization.defaultLocale,
5
5
  {
6
6
  ...options,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/formatters/compact.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport { LocalesValues } from '@intlayer/config/client';\nimport { Intl } from '../utils/intl';\n\n/**\n * Formats a numeric value using compact notation (e.g., 1K, 1M, 1B)\n * based on locale and formatting options.\n *\n * @example\n * compact({ value: 1200 }); // \"1.2K\"\n *\n * @example\n * compact({ value: \"1000000\", locale: Locales.FRENCH, compactDisplay: \"long\" });\n * // \"1 million\"\n */\nexport const compact = (\n value: string | number,\n options?: Intl.NumberFormatOptions & { locale?: LocalesValues }\n): string =>\n new Intl.NumberFormat(\n options?.locale ?? configuration.internationalization.defaultLocale,\n {\n ...options,\n notation: 'compact',\n }\n ).format(Number(value));\n"],"mappings":"AAAA,OAAO,mBAAmB;AAE1B,SAAS,YAAY;AAad,MAAM,UAAU,CACrB,OACA,YAEA,IAAI,KAAK;AAAA,EACP,SAAS,UAAU,cAAc,qBAAqB;AAAA,EACtD;AAAA,IACE,GAAG;AAAA,IACH,UAAU;AAAA,EACZ;AACF,EAAE,OAAO,OAAO,KAAK,CAAC;","names":[]}
1
+ {"version":3,"sources":["../../../src/formatters/compact.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport { LocalesValues } from '@intlayer/config/client';\nimport { Intl as CachedIntl } from '../utils/intl';\n\n/**\n * Formats a numeric value using compact notation (e.g., 1K, 1M, 1B)\n * based on locale and formatting options.\n *\n * @example\n * compact({ value: 1200 }); // \"1.2K\"\n *\n * @example\n * compact({ value: \"1000000\", locale: Locales.FRENCH, compactDisplay: \"long\" });\n * // \"1 million\"\n */\nexport const compact = (\n value: string | number,\n options?: Intl.NumberFormatOptions & { locale?: LocalesValues }\n): string =>\n new CachedIntl.NumberFormat(\n options?.locale ?? configuration.internationalization.defaultLocale,\n {\n ...options,\n notation: 'compact',\n }\n ).format(Number(value));\n"],"mappings":"AAAA,OAAO,mBAAmB;AAE1B,SAAS,QAAQ,kBAAkB;AAa5B,MAAM,UAAU,CACrB,OACA,YAEA,IAAI,WAAW;AAAA,EACb,SAAS,UAAU,cAAc,qBAAqB;AAAA,EACtD;AAAA,IACE,GAAG;AAAA,IACH,UAAU;AAAA,EACZ;AACF,EAAE,OAAO,OAAO,KAAK,CAAC;","names":[]}
@@ -1,6 +1,6 @@
1
1
  import configuration from "@intlayer/config/built";
2
- import { Intl } from "../utils/intl.mjs";
3
- const currency = (value, options) => new Intl.NumberFormat(
2
+ import { Intl as CachedIntl } from "../utils/intl.mjs";
3
+ const currency = (value, options) => new CachedIntl.NumberFormat(
4
4
  options?.locale ?? configuration.internationalization.defaultLocale,
5
5
  {
6
6
  style: "currency",
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/formatters/currency.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport { type LocalesValues } from '@intlayer/config/client';\nimport { Intl } from '../utils/intl';\n\n/**\n * Formats a numeric or string value into a localized currency string using the Intl API.\n *\n * @example\n * currency({ value: 1234.5, currency: 'EUR' });\n * // \"€1,234.50\"\n *\n * @example\n * currency({ value: \"5000\", locale: Locales.FRENCH, currency: \"CAD\", currencyDisplay: \"code\" });\n * // \"5 000,00 CAD\"\n */\nexport const currency = (\n value: string | number,\n options?: Intl.NumberFormatOptions & { locale?: LocalesValues }\n): string =>\n new Intl.NumberFormat(\n options?.locale ?? configuration.internationalization.defaultLocale,\n {\n style: 'currency',\n currency: options?.currency ?? 'USD',\n currencyDisplay: options?.currencyDisplay ?? 'symbol',\n minimumFractionDigits: options?.minimumFractionDigits ?? 2,\n maximumFractionDigits: options?.maximumFractionDigits ?? 2,\n ...options,\n }\n ).format(Number(value));\n"],"mappings":"AAAA,OAAO,mBAAmB;AAE1B,SAAS,YAAY;AAad,MAAM,WAAW,CACtB,OACA,YAEA,IAAI,KAAK;AAAA,EACP,SAAS,UAAU,cAAc,qBAAqB;AAAA,EACtD;AAAA,IACE,OAAO;AAAA,IACP,UAAU,SAAS,YAAY;AAAA,IAC/B,iBAAiB,SAAS,mBAAmB;AAAA,IAC7C,uBAAuB,SAAS,yBAAyB;AAAA,IACzD,uBAAuB,SAAS,yBAAyB;AAAA,IACzD,GAAG;AAAA,EACL;AACF,EAAE,OAAO,OAAO,KAAK,CAAC;","names":[]}
1
+ {"version":3,"sources":["../../../src/formatters/currency.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport { type LocalesValues } from '@intlayer/config/client';\nimport { Intl as CachedIntl } from '../utils/intl';\n\n/**\n * Formats a numeric or string value into a localized currency string using the Intl API.\n *\n * @example\n * currency({ value: 1234.5, currency: 'EUR' });\n * // \"€1,234.50\"\n *\n * @example\n * currency({ value: \"5000\", locale: Locales.FRENCH, currency: \"CAD\", currencyDisplay: \"code\" });\n * // \"5 000,00 CAD\"\n */\nexport const currency = (\n value: string | number,\n options?: Intl.NumberFormatOptions & { locale?: LocalesValues }\n): string =>\n new CachedIntl.NumberFormat(\n options?.locale ?? configuration.internationalization.defaultLocale,\n {\n style: 'currency',\n currency: options?.currency ?? 'USD',\n currencyDisplay: options?.currencyDisplay ?? 'symbol',\n minimumFractionDigits: options?.minimumFractionDigits ?? 2,\n maximumFractionDigits: options?.maximumFractionDigits ?? 2,\n ...options,\n }\n ).format(Number(value));\n"],"mappings":"AAAA,OAAO,mBAAmB;AAE1B,SAAS,QAAQ,kBAAkB;AAa5B,MAAM,WAAW,CACtB,OACA,YAEA,IAAI,WAAW;AAAA,EACb,SAAS,UAAU,cAAc,qBAAqB;AAAA,EACtD;AAAA,IACE,OAAO;AAAA,IACP,UAAU,SAAS,YAAY;AAAA,IAC/B,iBAAiB,SAAS,mBAAmB;AAAA,IAC7C,uBAAuB,SAAS,yBAAyB;AAAA,IACzD,uBAAuB,SAAS,yBAAyB;AAAA,IACzD,GAAG;AAAA,EACL;AACF,EAAE,OAAO,OAAO,KAAK,CAAC;","names":[]}
@@ -1,5 +1,5 @@
1
1
  import configuration from "@intlayer/config/built";
2
- import { Intl } from "../utils/intl.mjs";
2
+ import { Intl as CachedIntl } from "../utils/intl.mjs";
3
3
  const presets = {
4
4
  short: {
5
5
  year: "2-digit",
@@ -37,7 +37,7 @@ const presets = {
37
37
  const date = (date2, options) => {
38
38
  const dateTime = new Date(date2);
39
39
  const resolvedOptions = typeof options === "string" ? presets[options] ?? {} : options;
40
- const formatter = new Intl.DateTimeFormat(
40
+ const formatter = new CachedIntl.DateTimeFormat(
41
41
  options?.locale ?? configuration.internationalization.defaultLocale,
42
42
  resolvedOptions
43
43
  );
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/formatters/date.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport { type LocalesValues } from '@intlayer/config/client';\nimport { Intl } from '../utils/intl';\n\ntype DateTimePreset = 'short' | 'long' | 'dateOnly' | 'timeOnly' | 'full';\n\nconst presets: Record<DateTimePreset, Intl.DateTimeFormatOptions> = {\n short: {\n year: '2-digit',\n month: '2-digit',\n day: '2-digit',\n hour: '2-digit',\n minute: '2-digit',\n },\n long: {\n year: 'numeric',\n month: 'long',\n day: 'numeric',\n hour: 'numeric',\n minute: 'numeric',\n },\n full: {\n year: 'numeric',\n month: 'long',\n day: 'numeric',\n hour: 'numeric',\n minute: 'numeric',\n hour12: false,\n },\n dateOnly: {\n year: 'numeric',\n month: 'short',\n day: 'numeric',\n },\n timeOnly: {\n hour: 'numeric',\n minute: 'numeric',\n second: 'numeric',\n },\n};\n\n/**\n * Formats a date/time value into a localized string using Intl.DateTimeFormat.\n *\n * @example\n * date({ date: new Date(), options: \"short\" });\n * // \"08/02/25, 14:30\"\n *\n * @example\n * date({ date: \"2025-08-02T14:30:00Z\", locale: Locales.FRENCH, options: { month: \"long\", day: \"numeric\" } });\n * // \"2 août\"\n */\nexport const date = (\n date: Date | string | number,\n options?: Intl.DateTimeFormatOptions & { locale?: LocalesValues }\n): string => {\n const dateTime = new Date(date);\n\n const resolvedOptions =\n typeof options === 'string' ? (presets[options] ?? {}) : options;\n\n const formatter = new Intl.DateTimeFormat(\n options?.locale ?? configuration.internationalization.defaultLocale,\n resolvedOptions\n );\n\n return formatter.format(dateTime);\n};\n"],"mappings":"AAAA,OAAO,mBAAmB;AAE1B,SAAS,YAAY;AAIrB,MAAM,UAA8D;AAAA,EAClE,OAAO;AAAA,IACL,MAAM;AAAA,IACN,OAAO;AAAA,IACP,KAAK;AAAA,IACL,MAAM;AAAA,IACN,QAAQ;AAAA,EACV;AAAA,EACA,MAAM;AAAA,IACJ,MAAM;AAAA,IACN,OAAO;AAAA,IACP,KAAK;AAAA,IACL,MAAM;AAAA,IACN,QAAQ;AAAA,EACV;AAAA,EACA,MAAM;AAAA,IACJ,MAAM;AAAA,IACN,OAAO;AAAA,IACP,KAAK;AAAA,IACL,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,QAAQ;AAAA,EACV;AAAA,EACA,UAAU;AAAA,IACR,MAAM;AAAA,IACN,OAAO;AAAA,IACP,KAAK;AAAA,EACP;AAAA,EACA,UAAU;AAAA,IACR,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,QAAQ;AAAA,EACV;AACF;AAaO,MAAM,OAAO,CAClBA,OACA,YACW;AACX,QAAM,WAAW,IAAI,KAAKA,KAAI;AAE9B,QAAM,kBACJ,OAAO,YAAY,WAAY,QAAQ,OAAO,KAAK,CAAC,IAAK;AAE3D,QAAM,YAAY,IAAI,KAAK;AAAA,IACzB,SAAS,UAAU,cAAc,qBAAqB;AAAA,IACtD;AAAA,EACF;AAEA,SAAO,UAAU,OAAO,QAAQ;AAClC;","names":["date"]}
1
+ {"version":3,"sources":["../../../src/formatters/date.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport { type LocalesValues } from '@intlayer/config/client';\nimport { Intl as CachedIntl } from '../utils/intl';\n\ntype DateTimePreset = 'short' | 'long' | 'dateOnly' | 'timeOnly' | 'full';\n\nconst presets: Record<DateTimePreset, Intl.DateTimeFormatOptions> = {\n short: {\n year: '2-digit',\n month: '2-digit',\n day: '2-digit',\n hour: '2-digit',\n minute: '2-digit',\n },\n long: {\n year: 'numeric',\n month: 'long',\n day: 'numeric',\n hour: 'numeric',\n minute: 'numeric',\n },\n full: {\n year: 'numeric',\n month: 'long',\n day: 'numeric',\n hour: 'numeric',\n minute: 'numeric',\n hour12: false,\n },\n dateOnly: {\n year: 'numeric',\n month: 'short',\n day: 'numeric',\n },\n timeOnly: {\n hour: 'numeric',\n minute: 'numeric',\n second: 'numeric',\n },\n};\n\n/**\n * Formats a date/time value into a localized string using Intl.DateTimeFormat.\n *\n * @example\n * date({ date: new Date(), options: \"short\" });\n * // \"08/02/25, 14:30\"\n *\n * @example\n * date({ date: \"2025-08-02T14:30:00Z\", locale: Locales.FRENCH, options: { month: \"long\", day: \"numeric\" } });\n * // \"2 août\"\n */\nexport const date = (\n date: Date | string | number,\n options?: Intl.DateTimeFormatOptions & { locale?: LocalesValues }\n): string => {\n const dateTime = new Date(date);\n\n const resolvedOptions =\n typeof options === 'string' ? (presets[options] ?? {}) : options;\n\n const formatter = new CachedIntl.DateTimeFormat(\n options?.locale ?? configuration.internationalization.defaultLocale,\n resolvedOptions\n );\n\n return formatter.format(dateTime);\n};\n"],"mappings":"AAAA,OAAO,mBAAmB;AAE1B,SAAS,QAAQ,kBAAkB;AAInC,MAAM,UAA8D;AAAA,EAClE,OAAO;AAAA,IACL,MAAM;AAAA,IACN,OAAO;AAAA,IACP,KAAK;AAAA,IACL,MAAM;AAAA,IACN,QAAQ;AAAA,EACV;AAAA,EACA,MAAM;AAAA,IACJ,MAAM;AAAA,IACN,OAAO;AAAA,IACP,KAAK;AAAA,IACL,MAAM;AAAA,IACN,QAAQ;AAAA,EACV;AAAA,EACA,MAAM;AAAA,IACJ,MAAM;AAAA,IACN,OAAO;AAAA,IACP,KAAK;AAAA,IACL,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,QAAQ;AAAA,EACV;AAAA,EACA,UAAU;AAAA,IACR,MAAM;AAAA,IACN,OAAO;AAAA,IACP,KAAK;AAAA,EACP;AAAA,EACA,UAAU;AAAA,IACR,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,QAAQ;AAAA,EACV;AACF;AAaO,MAAM,OAAO,CAClBA,OACA,YACW;AACX,QAAM,WAAW,IAAI,KAAKA,KAAI;AAE9B,QAAM,kBACJ,OAAO,YAAY,WAAY,QAAQ,OAAO,KAAK,CAAC,IAAK;AAE3D,QAAM,YAAY,IAAI,WAAW;AAAA,IAC/B,SAAS,UAAU,cAAc,qBAAqB;AAAA,IACtD;AAAA,EACF;AAEA,SAAO,UAAU,OAAO,QAAQ;AAClC;","names":["date"]}
@@ -1,6 +1,6 @@
1
1
  import configuration from "@intlayer/config/built";
2
- import { Intl } from "../utils/intl.mjs";
3
- const list = (values, options) => new Intl.ListFormat(
2
+ import { Intl as CachedIntl } from "../utils/intl.mjs";
3
+ const list = (values, options) => new CachedIntl.ListFormat(
4
4
  options?.locale ?? configuration.internationalization.defaultLocale,
5
5
  {
6
6
  type: options?.type ?? "conjunction",
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/formatters/list.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport { type LocalesValues } from '@intlayer/config/client';\nimport { Intl } from '../utils/intl';\n\n/**\n * Formats an array of values into a localized list string using the Intl API.\n *\n * @example\n * list(['apple', 'banana', 'orange']);\n * // \"apple, banana, and orange\"\n *\n * @example\n * list(['red', 'green', 'blue'], { locale: Locales.FRENCH, type: 'disjunction' });\n * // \"rouge, vert ou bleu\"\n *\n * @example\n * list([1, 2, 3], { type: 'unit' });\n * // \"1, 2, 3\"\n */\nexport const list = (\n values: (string | number)[],\n options?: Intl.ListFormatOptions & { locale?: LocalesValues }\n): string =>\n new Intl.ListFormat(\n options?.locale ?? configuration.internationalization.defaultLocale,\n {\n type: options?.type ?? 'conjunction',\n style: options?.style ?? 'long',\n ...options,\n }\n ).format(values.map(String));\n"],"mappings":"AAAA,OAAO,mBAAmB;AAE1B,SAAS,YAAY;AAiBd,MAAM,OAAO,CAClB,QACA,YAEA,IAAI,KAAK;AAAA,EACP,SAAS,UAAU,cAAc,qBAAqB;AAAA,EACtD;AAAA,IACE,MAAM,SAAS,QAAQ;AAAA,IACvB,OAAO,SAAS,SAAS;AAAA,IACzB,GAAG;AAAA,EACL;AACF,EAAE,OAAO,OAAO,IAAI,MAAM,CAAC;","names":[]}
1
+ {"version":3,"sources":["../../../src/formatters/list.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport { type LocalesValues } from '@intlayer/config/client';\nimport { Intl as CachedIntl } from '../utils/intl';\n\n/**\n * Formats an array of values into a localized list string using the Intl API.\n *\n * @example\n * list(['apple', 'banana', 'orange']);\n * // \"apple, banana, and orange\"\n *\n * @example\n * list(['red', 'green', 'blue'], { locale: Locales.FRENCH, type: 'disjunction' });\n * // \"rouge, vert ou bleu\"\n *\n * @example\n * list([1, 2, 3], { type: 'unit' });\n * // \"1, 2, 3\"\n */\nexport const list = (\n values: (string | number)[],\n options?: Intl.ListFormatOptions & { locale?: LocalesValues }\n): string =>\n new CachedIntl.ListFormat(\n options?.locale ?? configuration.internationalization.defaultLocale,\n {\n type: options?.type ?? 'conjunction',\n style: options?.style ?? 'long',\n ...options,\n }\n ).format(values.map(String));\n"],"mappings":"AAAA,OAAO,mBAAmB;AAE1B,SAAS,QAAQ,kBAAkB;AAiB5B,MAAM,OAAO,CAClB,QACA,YAEA,IAAI,WAAW;AAAA,EACb,SAAS,UAAU,cAAc,qBAAqB;AAAA,EACtD;AAAA,IACE,MAAM,SAAS,QAAQ;AAAA,IACvB,OAAO,SAAS,SAAS;AAAA,IACzB,GAAG;AAAA,EACL;AACF,EAAE,OAAO,OAAO,IAAI,MAAM,CAAC;","names":[]}
@@ -1,6 +1,6 @@
1
1
  import configuration from "@intlayer/config/built";
2
- import { Intl } from "../utils/intl.mjs";
3
- const number = (value, options) => new Intl.NumberFormat(
2
+ import { Intl as CachedIntl } from "../utils/intl.mjs";
3
+ const number = (value, options) => new CachedIntl.NumberFormat(
4
4
  options?.locale ?? configuration.internationalization.defaultLocale,
5
5
  options
6
6
  ).format(Number(value));
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/formatters/number.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport { type LocalesValues } from '@intlayer/config/client';\nimport { Intl } from '../utils/intl';\n\n/**\n * Formats a numeric value using locale-aware formatting.\n *\n * @example\n * number({ value: 123456.789 }); // \"123,456.789\"\n * number({ value: \"1000000\", locale: Locales.FRENCH }); // \"1 000 000\"\n */\nexport const number = (\n value: string | number,\n options?: Intl.NumberFormatOptions & { locale?: LocalesValues }\n): string =>\n new Intl.NumberFormat(\n options?.locale ?? configuration.internationalization.defaultLocale,\n options\n ).format(Number(value));\n"],"mappings":"AAAA,OAAO,mBAAmB;AAE1B,SAAS,YAAY;AASd,MAAM,SAAS,CACpB,OACA,YAEA,IAAI,KAAK;AAAA,EACP,SAAS,UAAU,cAAc,qBAAqB;AAAA,EACtD;AACF,EAAE,OAAO,OAAO,KAAK,CAAC;","names":[]}
1
+ {"version":3,"sources":["../../../src/formatters/number.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport { type LocalesValues } from '@intlayer/config/client';\nimport { Intl as CachedIntl } from '../utils/intl';\n\n/**\n * Formats a numeric value using locale-aware formatting.\n *\n * @example\n * number({ value: 123456.789 }); // \"123,456.789\"\n * number({ value: \"1000000\", locale: Locales.FRENCH }); // \"1 000 000\"\n */\nexport const number = (\n value: string | number,\n options?: Intl.NumberFormatOptions & { locale?: LocalesValues }\n): string =>\n new CachedIntl.NumberFormat(\n options?.locale ?? configuration.internationalization.defaultLocale,\n options\n ).format(Number(value));\n"],"mappings":"AAAA,OAAO,mBAAmB;AAE1B,SAAS,QAAQ,kBAAkB;AAS5B,MAAM,SAAS,CACpB,OACA,YAEA,IAAI,WAAW;AAAA,EACb,SAAS,UAAU,cAAc,qBAAqB;AAAA,EACtD;AACF,EAAE,OAAO,OAAO,KAAK,CAAC;","names":[]}
@@ -1,11 +1,11 @@
1
1
  import configuration from "@intlayer/config/built";
2
- import { Intl } from "../utils/intl.mjs";
2
+ import { Intl as CachedIntl } from "../utils/intl.mjs";
3
3
  const percentage = (value, options) => {
4
4
  let numericValue = Number(value);
5
5
  if (numericValue > 1) {
6
6
  numericValue = numericValue / 100;
7
7
  }
8
- const formatter = new Intl.NumberFormat(
8
+ const formatter = new CachedIntl.NumberFormat(
9
9
  options?.locale ?? configuration.internationalization.defaultLocale,
10
10
  {
11
11
  style: "percent",
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/formatters/percentage.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport { type LocalesValues } from '@intlayer/config/client';\nimport { Intl } from '../utils/intl';\n\n/**\n * Formats a number as a percentage string (e.g., 0.25 → \"25%\").\n *\n * @example\n * percentage({ value: 0.25 }) // \"25%\"\n * percentage({ value: 0.25, minimumFractionDigits: 2 }) // \"25.00%\"\n */\nexport const percentage = (\n value: string | number,\n options?: Intl.NumberFormatOptions & { locale?: LocalesValues }\n): string => {\n let numericValue = Number(value);\n\n // Normalize: if user passes 10, treat it as 10% instead of 1000%\n if (numericValue > 1) {\n numericValue = numericValue / 100;\n }\n\n const formatter = new Intl.NumberFormat(\n options?.locale ?? configuration.internationalization.defaultLocale,\n {\n style: 'percent',\n ...options,\n }\n );\n\n return formatter.format(Number(numericValue));\n};\n"],"mappings":"AAAA,OAAO,mBAAmB;AAE1B,SAAS,YAAY;AASd,MAAM,aAAa,CACxB,OACA,YACW;AACX,MAAI,eAAe,OAAO,KAAK;AAG/B,MAAI,eAAe,GAAG;AACpB,mBAAe,eAAe;AAAA,EAChC;AAEA,QAAM,YAAY,IAAI,KAAK;AAAA,IACzB,SAAS,UAAU,cAAc,qBAAqB;AAAA,IACtD;AAAA,MACE,OAAO;AAAA,MACP,GAAG;AAAA,IACL;AAAA,EACF;AAEA,SAAO,UAAU,OAAO,OAAO,YAAY,CAAC;AAC9C;","names":[]}
1
+ {"version":3,"sources":["../../../src/formatters/percentage.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport { type LocalesValues } from '@intlayer/config/client';\nimport { Intl as CachedIntl } from '../utils/intl';\n\n/**\n * Formats a number as a percentage string (e.g., 0.25 → \"25%\").\n *\n * @example\n * percentage({ value: 0.25 }) // \"25%\"\n * percentage({ value: 0.25, minimumFractionDigits: 2 }) // \"25.00%\"\n */\nexport const percentage = (\n value: string | number,\n options?: Intl.NumberFormatOptions & { locale?: LocalesValues }\n): string => {\n let numericValue = Number(value);\n\n // Normalize: if user passes 10, treat it as 10% instead of 1000%\n if (numericValue > 1) {\n numericValue = numericValue / 100;\n }\n\n const formatter = new CachedIntl.NumberFormat(\n options?.locale ?? configuration.internationalization.defaultLocale,\n {\n style: 'percent',\n ...options,\n }\n );\n\n return formatter.format(Number(numericValue));\n};\n"],"mappings":"AAAA,OAAO,mBAAmB;AAE1B,SAAS,QAAQ,kBAAkB;AAS5B,MAAM,aAAa,CACxB,OACA,YACW;AACX,MAAI,eAAe,OAAO,KAAK;AAG/B,MAAI,eAAe,GAAG;AACpB,mBAAe,eAAe;AAAA,EAChC;AAEA,QAAM,YAAY,IAAI,WAAW;AAAA,IAC/B,SAAS,UAAU,cAAc,qBAAqB;AAAA,IACtD;AAAA,MACE,OAAO;AAAA,MACP,GAAG;AAAA,IACL;AAAA,EACF;AAEA,SAAO,UAAU,OAAO,OAAO,YAAY,CAAC;AAC9C;","names":[]}
@@ -1,5 +1,5 @@
1
1
  import configuration from "@intlayer/config/built";
2
- import { Intl } from "../utils/intl.mjs";
2
+ import { Intl as CachedIntl } from "../utils/intl.mjs";
3
3
  const diffInUnit = (from, to, unit) => {
4
4
  const msDiff = to.getTime() - from.getTime();
5
5
  const sec = msDiff / 1e3;
@@ -30,7 +30,7 @@ const relativeTime = (from, to = /* @__PURE__ */ new Date(), options) => {
30
30
  const toDate = new Date(to);
31
31
  const unit = options?.unit ?? "second";
32
32
  const value = diffInUnit(fromDate, toDate, unit);
33
- return new Intl.RelativeTimeFormat(
33
+ return new CachedIntl.RelativeTimeFormat(
34
34
  options?.locale ?? configuration.internationalization.defaultLocale,
35
35
  options
36
36
  ).format(Math.round(value), unit);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/formatters/relativeTime.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport { type LocalesValues } from '@intlayer/config/client';\nimport { Intl } from '../utils/intl';\n\ntype RelativeTimeUnit = Intl.RelativeTimeFormatUnit;\n\n/**\n * Calculate the difference between 2 dates in the given unit.\n */\nconst diffInUnit = (from: Date, to: Date, unit: RelativeTimeUnit): number => {\n const msDiff = to.getTime() - from.getTime();\n const sec = msDiff / 1000;\n\n switch (unit) {\n case 'second':\n return sec;\n case 'minute':\n return sec / 60;\n case 'hour':\n return sec / 3600;\n case 'day':\n return sec / 86400;\n case 'month':\n return sec / (30 * 86400); // approx\n case 'quarter':\n return sec / (3 * 30 * 86400); // 3 months approx\n case 'year':\n return sec / (365 * 86400); // approx\n default:\n return sec;\n }\n};\n\nexport const relativeTime = (\n from: Date | string | number,\n to: Date | string | number = new Date(),\n options?: Intl.RelativeTimeFormatOptions & {\n locale?: LocalesValues;\n unit?: RelativeTimeUnit;\n }\n): string => {\n const fromDate = new Date(from);\n const toDate = new Date(to);\n const unit = options?.unit ?? 'second';\n\n const value = diffInUnit(fromDate, toDate, unit);\n\n return new Intl.RelativeTimeFormat(\n options?.locale ?? configuration.internationalization.defaultLocale,\n options\n ).format(Math.round(value), unit);\n};\n"],"mappings":"AAAA,OAAO,mBAAmB;AAE1B,SAAS,YAAY;AAOrB,MAAM,aAAa,CAAC,MAAY,IAAU,SAAmC;AAC3E,QAAM,SAAS,GAAG,QAAQ,IAAI,KAAK,QAAQ;AAC3C,QAAM,MAAM,SAAS;AAErB,UAAQ,MAAM;AAAA,IACZ,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO,MAAM;AAAA,IACf,KAAK;AACH,aAAO,MAAM;AAAA,IACf,KAAK;AACH,aAAO,MAAM;AAAA,IACf,KAAK;AACH,aAAO,OAAO,KAAK;AAAA;AAAA,IACrB,KAAK;AACH,aAAO,OAAO,IAAI,KAAK;AAAA;AAAA,IACzB,KAAK;AACH,aAAO,OAAO,MAAM;AAAA;AAAA,IACtB;AACE,aAAO;AAAA,EACX;AACF;AAEO,MAAM,eAAe,CAC1B,MACA,KAA6B,oBAAI,KAAK,GACtC,YAIW;AACX,QAAM,WAAW,IAAI,KAAK,IAAI;AAC9B,QAAM,SAAS,IAAI,KAAK,EAAE;AAC1B,QAAM,OAAO,SAAS,QAAQ;AAE9B,QAAM,QAAQ,WAAW,UAAU,QAAQ,IAAI;AAE/C,SAAO,IAAI,KAAK;AAAA,IACd,SAAS,UAAU,cAAc,qBAAqB;AAAA,IACtD;AAAA,EACF,EAAE,OAAO,KAAK,MAAM,KAAK,GAAG,IAAI;AAClC;","names":[]}
1
+ {"version":3,"sources":["../../../src/formatters/relativeTime.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport { type LocalesValues } from '@intlayer/config/client';\nimport { Intl as CachedIntl } from '../utils/intl';\n\ntype RelativeTimeUnit = Intl.RelativeTimeFormatUnit;\n\n/**\n * Calculate the difference between 2 dates in the given unit.\n */\nconst diffInUnit = (from: Date, to: Date, unit: RelativeTimeUnit): number => {\n const msDiff = to.getTime() - from.getTime();\n const sec = msDiff / 1000;\n\n switch (unit) {\n case 'second':\n return sec;\n case 'minute':\n return sec / 60;\n case 'hour':\n return sec / 3600;\n case 'day':\n return sec / 86400;\n case 'month':\n return sec / (30 * 86400); // approx\n case 'quarter':\n return sec / (3 * 30 * 86400); // 3 months approx\n case 'year':\n return sec / (365 * 86400); // approx\n default:\n return sec;\n }\n};\n\nexport const relativeTime = (\n from: Date | string | number,\n to: Date | string | number = new Date(),\n options?: Intl.RelativeTimeFormatOptions & {\n locale?: LocalesValues;\n unit?: RelativeTimeUnit;\n }\n): string => {\n const fromDate = new Date(from);\n const toDate = new Date(to);\n const unit = options?.unit ?? 'second';\n\n const value = diffInUnit(fromDate, toDate, unit);\n\n return new CachedIntl.RelativeTimeFormat(\n options?.locale ?? configuration.internationalization.defaultLocale,\n options\n ).format(Math.round(value), unit);\n};\n"],"mappings":"AAAA,OAAO,mBAAmB;AAE1B,SAAS,QAAQ,kBAAkB;AAOnC,MAAM,aAAa,CAAC,MAAY,IAAU,SAAmC;AAC3E,QAAM,SAAS,GAAG,QAAQ,IAAI,KAAK,QAAQ;AAC3C,QAAM,MAAM,SAAS;AAErB,UAAQ,MAAM;AAAA,IACZ,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO,MAAM;AAAA,IACf,KAAK;AACH,aAAO,MAAM;AAAA,IACf,KAAK;AACH,aAAO,MAAM;AAAA,IACf,KAAK;AACH,aAAO,OAAO,KAAK;AAAA;AAAA,IACrB,KAAK;AACH,aAAO,OAAO,IAAI,KAAK;AAAA;AAAA,IACzB,KAAK;AACH,aAAO,OAAO,MAAM;AAAA;AAAA,IACtB;AACE,aAAO;AAAA,EACX;AACF;AAEO,MAAM,eAAe,CAC1B,MACA,KAA6B,oBAAI,KAAK,GACtC,YAIW;AACX,QAAM,WAAW,IAAI,KAAK,IAAI;AAC9B,QAAM,SAAS,IAAI,KAAK,EAAE;AAC1B,QAAM,OAAO,SAAS,QAAQ;AAE9B,QAAM,QAAQ,WAAW,UAAU,QAAQ,IAAI;AAE/C,SAAO,IAAI,WAAW;AAAA,IACpB,SAAS,UAAU,cAAc,qBAAqB;AAAA,IACtD;AAAA,EACF,EAAE,OAAO,KAAK,MAAM,KAAK,GAAG,IAAI;AAClC;","names":[]}
@@ -1,12 +1,12 @@
1
1
  import configuration from "@intlayer/config/built";
2
- import { Intl } from "../utils/intl.mjs";
3
- const units = (value, options) => new Intl.NumberFormat(
4
- options.locale ?? configuration.internationalization.defaultLocale,
2
+ import { Intl as CachedIntl } from "../utils/intl.mjs";
3
+ const units = (value, options) => new CachedIntl.NumberFormat(
4
+ options?.locale ?? configuration.internationalization.defaultLocale,
5
5
  {
6
6
  style: "unit",
7
- unit: options.unit ?? "day",
8
- unitDisplay: options.unitDisplay ?? "short",
9
- useGrouping: options.useGrouping ?? false
7
+ unit: options?.unit ?? "day",
8
+ unitDisplay: options?.unitDisplay ?? "short",
9
+ useGrouping: options?.useGrouping ?? false
10
10
  }
11
11
  ).format(Number(value));
12
12
  export {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/formatters/units.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport { type LocalesValues } from '@intlayer/config/client';\nimport { Intl } from '../utils/intl';\n\n/**\n * Formats a numeric value as a localized unit string.\n *\n * @example\n * units({ value: 5, unit: \"kilometer\", unitDisplay: \"long\", locale: \"en-GB\" })\n * // \"5 kilometers\"\n */\nexport const units = (\n value: number | string,\n options?: Intl.NumberFormatOptions & { locale?: LocalesValues }\n): string =>\n new Intl.NumberFormat(\n options.locale ?? configuration.internationalization.defaultLocale,\n {\n style: 'unit',\n unit: options.unit ?? 'day',\n unitDisplay: options.unitDisplay ?? 'short',\n useGrouping: options.useGrouping ?? false,\n }\n ).format(Number(value));\n"],"mappings":"AAAA,OAAO,mBAAmB;AAE1B,SAAS,YAAY;AASd,MAAM,QAAQ,CACnB,OACA,YAEA,IAAI,KAAK;AAAA,EACP,QAAQ,UAAU,cAAc,qBAAqB;AAAA,EACrD;AAAA,IACE,OAAO;AAAA,IACP,MAAM,QAAQ,QAAQ;AAAA,IACtB,aAAa,QAAQ,eAAe;AAAA,IACpC,aAAa,QAAQ,eAAe;AAAA,EACtC;AACF,EAAE,OAAO,OAAO,KAAK,CAAC;","names":[]}
1
+ {"version":3,"sources":["../../../src/formatters/units.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport { type LocalesValues } from '@intlayer/config/client';\nimport { Intl as CachedIntl } from '../utils/intl';\n\n/**\n * Formats a numeric value as a localized unit string.\n *\n * @example\n * units({ value: 5, unit: \"kilometer\", unitDisplay: \"long\", locale: \"en-GB\" })\n * // \"5 kilometers\"\n */\nexport const units = (\n value: number | string,\n options?: Intl.NumberFormatOptions & { locale?: LocalesValues }\n): string =>\n new CachedIntl.NumberFormat(\n options?.locale ?? configuration.internationalization.defaultLocale,\n {\n style: 'unit',\n unit: options?.unit ?? 'day',\n unitDisplay: options?.unitDisplay ?? 'short',\n useGrouping: options?.useGrouping ?? false,\n }\n ).format(Number(value));\n"],"mappings":"AAAA,OAAO,mBAAmB;AAE1B,SAAS,QAAQ,kBAAkB;AAS5B,MAAM,QAAQ,CACnB,OACA,YAEA,IAAI,WAAW;AAAA,EACb,SAAS,UAAU,cAAc,qBAAqB;AAAA,EACtD;AAAA,IACE,OAAO;AAAA,IACP,MAAM,SAAS,QAAQ;AAAA,IACvB,aAAa,SAAS,eAAe;AAAA,IACrC,aAAa,SAAS,eAAe;AAAA,EACvC;AACF,EAAE,OAAO,OAAO,KAAK,CAAC;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intlayer/core",
3
- "version": "5.8.0-canary.0",
3
+ "version": "5.8.1-canary.0",
4
4
  "private": false,
5
5
  "description": "Includes core Intlayer functions like translation, dictionary, and utility functions shared across multiple packages.",
6
6
  "keywords": [
@@ -120,9 +120,9 @@
120
120
  ],
121
121
  "dependencies": {
122
122
  "negotiator": "^1.0.0",
123
- "@intlayer/config": "5.8.0-canary.0",
124
- "@intlayer/dictionaries-entry": "5.8.0-canary.0",
125
- "@intlayer/api": "5.8.0-canary.0"
123
+ "@intlayer/config": "5.8.1-canary.0",
124
+ "@intlayer/dictionaries-entry": "5.8.1-canary.0",
125
+ "@intlayer/api": "5.8.1-canary.0"
126
126
  },
127
127
  "devDependencies": {
128
128
  "@types/negotiator": "^0.6.3",
@@ -136,16 +136,16 @@
136
136
  "tsup": "^8.5.0",
137
137
  "typescript": "^5.9.2",
138
138
  "vitest": "^3.2.2",
139
- "@utils/ts-config": "1.0.4",
140
- "@utils/tsup-config": "1.0.4",
141
139
  "@utils/eslint-config": "1.0.4",
142
- "@utils/ts-config-types": "1.0.4"
140
+ "@utils/ts-config": "1.0.4",
141
+ "@utils/ts-config-types": "1.0.4",
142
+ "@utils/tsup-config": "1.0.4"
143
143
  },
144
144
  "peerDependencies": {
145
- "@intlayer/api": "5.8.0-canary.0",
146
- "@intlayer/config": "5.8.0-canary.0",
147
- "@intlayer/dictionaries-entry": "5.8.0-canary.0",
148
- "intlayer": "5.8.0-canary.0"
145
+ "@intlayer/api": "5.8.1-canary.0",
146
+ "@intlayer/dictionaries-entry": "5.8.1-canary.0",
147
+ "@intlayer/config": "5.8.1-canary.0",
148
+ "intlayer": "5.8.1-canary.0"
149
149
  },
150
150
  "engines": {
151
151
  "node": ">=14.18"