intl-messageformat 10.5.14 → 10.7.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.
package/lib/src/core.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { parse, MessageFormatElement, ParserOptions } from '@formatjs/icu-messageformat-parser';
2
- import { Formatters, Formats, FormatXMLElementFn, PrimitiveType, MessageFormatPart } from './formatters';
1
+ import { MessageFormatElement, parse, ParserOptions } from '@formatjs/icu-messageformat-parser';
2
+ import { Formats, Formatters, FormatXMLElementFn, MessageFormatPart, PrimitiveType } from './formatters';
3
3
  export interface Options extends Omit<ParserOptions, 'locale'> {
4
4
  formatters?: Formatters;
5
5
  }
@@ -12,8 +12,8 @@ export declare class IntlMessageFormat {
12
12
  private readonly message;
13
13
  private readonly formatterCache;
14
14
  constructor(message: string | MessageFormatElement[], locales?: string | string[], overrideFormats?: Partial<Formats>, opts?: Options);
15
- format: <T = void>(values?: Record<string, PrimitiveType | T | FormatXMLElementFn<T>> | undefined) => string | T | (string | T)[];
16
- formatToParts: <T>(values?: Record<string, PrimitiveType | T | FormatXMLElementFn<T>> | undefined) => MessageFormatPart<T>[];
15
+ format: <T = void>(values?: Record<string, PrimitiveType | T | FormatXMLElementFn<T>>) => string | T | (string | T)[];
16
+ formatToParts: <T>(values?: Record<string, PrimitiveType | T | FormatXMLElementFn<T>>) => MessageFormatPart<T>[];
17
17
  resolvedOptions: () => {
18
18
  locale: string;
19
19
  };
package/lib/src/core.js CHANGED
@@ -4,8 +4,8 @@ Copyrights licensed under the New BSD License.
4
4
  See the accompanying LICENSE file for terms.
5
5
  */
6
6
  import { __assign, __rest, __spreadArray } from "tslib";
7
- import { parse, } from '@formatjs/icu-messageformat-parser';
8
7
  import { memoize, strategies } from '@formatjs/fast-memoize';
8
+ import { parse, } from '@formatjs/icu-messageformat-parser';
9
9
  import { formatToParts, PART_TYPE, } from './formatters';
10
10
  // -- MessageFormat --------------------------------------------------------
11
11
  function mergeConfig(c1, c2) {
@@ -84,8 +84,8 @@ function createDefaultFormatters(cache) {
84
84
  }
85
85
  var IntlMessageFormat = /** @class */ (function () {
86
86
  function IntlMessageFormat(message, locales, overrideFormats, opts) {
87
- var _this = this;
88
87
  if (locales === void 0) { locales = IntlMessageFormat.defaultLocale; }
88
+ var _this = this;
89
89
  this.formatterCache = {
90
90
  number: {},
91
91
  dateTime: {},
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "intl-messageformat",
3
- "version": "10.5.14",
3
+ "version": "10.7.0",
4
4
  "description": "Formats ICU Message strings with number, date, plural, and select placeholders to create localized messages.",
5
5
  "keywords": [
6
6
  "i18n",
@@ -31,10 +31,10 @@
31
31
  "module": "lib/index.js",
32
32
  "types": "index.d.ts",
33
33
  "dependencies": {
34
- "tslib": "^2.4.0",
35
- "@formatjs/ecma402-abstract": "2.0.0",
36
- "@formatjs/icu-messageformat-parser": "2.7.8",
37
- "@formatjs/fast-memoize": "2.2.0"
34
+ "tslib": "^2.7.0",
35
+ "@formatjs/ecma402-abstract": "2.2.0",
36
+ "@formatjs/fast-memoize": "2.2.1",
37
+ "@formatjs/icu-messageformat-parser": "2.7.10"
38
38
  },
39
39
  "sideEffects": false,
40
40
  "homepage": "https://github.com/formatjs/formatjs",
package/src/core.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { parse, MessageFormatElement, ParserOptions } from '@formatjs/icu-messageformat-parser';
2
- import { Formatters, Formats, FormatXMLElementFn, PrimitiveType, MessageFormatPart } from './formatters';
1
+ import { MessageFormatElement, parse, ParserOptions } from '@formatjs/icu-messageformat-parser';
2
+ import { Formats, Formatters, FormatXMLElementFn, MessageFormatPart, PrimitiveType } from './formatters';
3
3
  export interface Options extends Omit<ParserOptions, 'locale'> {
4
4
  formatters?: Formatters;
5
5
  }
@@ -12,8 +12,8 @@ export declare class IntlMessageFormat {
12
12
  private readonly message;
13
13
  private readonly formatterCache;
14
14
  constructor(message: string | MessageFormatElement[], locales?: string | string[], overrideFormats?: Partial<Formats>, opts?: Options);
15
- format: <T = void>(values?: Record<string, PrimitiveType | T | FormatXMLElementFn<T>> | undefined) => string | T | (string | T)[];
16
- formatToParts: <T>(values?: Record<string, PrimitiveType | T | FormatXMLElementFn<T>> | undefined) => MessageFormatPart<T>[];
15
+ format: <T = void>(values?: Record<string, PrimitiveType | T | FormatXMLElementFn<T>>) => string | T | (string | T)[];
16
+ formatToParts: <T>(values?: Record<string, PrimitiveType | T | FormatXMLElementFn<T>>) => MessageFormatPart<T>[];
17
17
  resolvedOptions: () => {
18
18
  locale: string;
19
19
  };
package/src/core.js CHANGED
@@ -7,8 +7,8 @@ See the accompanying LICENSE file for terms.
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
8
  exports.IntlMessageFormat = void 0;
9
9
  var tslib_1 = require("tslib");
10
- var icu_messageformat_parser_1 = require("@formatjs/icu-messageformat-parser");
11
10
  var fast_memoize_1 = require("@formatjs/fast-memoize");
11
+ var icu_messageformat_parser_1 = require("@formatjs/icu-messageformat-parser");
12
12
  var formatters_1 = require("./formatters");
13
13
  // -- MessageFormat --------------------------------------------------------
14
14
  function mergeConfig(c1, c2) {
@@ -87,8 +87,8 @@ function createDefaultFormatters(cache) {
87
87
  }
88
88
  var IntlMessageFormat = /** @class */ (function () {
89
89
  function IntlMessageFormat(message, locales, overrideFormats, opts) {
90
- var _this = this;
91
90
  if (locales === void 0) { locales = IntlMessageFormat.defaultLocale; }
91
+ var _this = this;
92
92
  this.formatterCache = {
93
93
  number: {},
94
94
  dateTime: {},
package/src/formatters.js CHANGED
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.formatToParts = exports.isFormatXMLElementFn = exports.PART_TYPE = void 0;
3
+ exports.PART_TYPE = void 0;
4
+ exports.isFormatXMLElementFn = isFormatXMLElementFn;
5
+ exports.formatToParts = formatToParts;
4
6
  var icu_messageformat_parser_1 = require("@formatjs/icu-messageformat-parser");
5
7
  var error_1 = require("./error");
6
8
  var PART_TYPE;
@@ -28,7 +30,6 @@ function mergeLiteral(parts) {
28
30
  function isFormatXMLElementFn(el) {
29
31
  return typeof el === 'function';
30
32
  }
31
- exports.isFormatXMLElementFn = isFormatXMLElementFn;
32
33
  // TODO(skeleton): add skeleton support
33
34
  function formatToParts(els, locales, formatters, formats, values, currentPluralValue,
34
35
  // For debugging
@@ -179,4 +180,3 @@ originalMessage) {
179
180
  }
180
181
  return mergeLiteral(result);
181
182
  }
182
- exports.formatToParts = formatToParts;