@formatjs/intl 3.1.6 → 3.1.8
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/list.d.ts +2 -2
- package/lib/src/list.js +2 -2
- package/lib/src/types.d.ts +3 -3
- package/package.json +4 -4
- package/src/list.d.ts +2 -2
- package/src/list.js +2 -2
- package/src/types.d.ts +3 -3
package/lib/src/list.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ import { Formatters, IntlFormatters, OnErrorFn, Part } from './types';
|
|
|
2
2
|
export declare function formatList(opts: {
|
|
3
3
|
locale: string;
|
|
4
4
|
onError: OnErrorFn;
|
|
5
|
-
}, getListFormat: Formatters['getListFormat'], values:
|
|
5
|
+
}, getListFormat: Formatters['getListFormat'], values: Iterable<string>, options: Parameters<IntlFormatters['formatList']>[1]): string;
|
|
6
6
|
export declare function formatListToParts<T>(opts: {
|
|
7
7
|
locale: string;
|
|
8
8
|
onError: OnErrorFn;
|
|
9
|
-
}, getListFormat: Formatters['getListFormat'], values:
|
|
9
|
+
}, getListFormat: Formatters['getListFormat'], values: Iterable<string | T>, options: Parameters<IntlFormatters['formatList']>[1]): Part[];
|
package/lib/src/list.js
CHANGED
|
@@ -37,8 +37,8 @@ export function formatListToParts(_a, getListFormat, values, options) {
|
|
|
37
37
|
var filteredOptions = filterProps(options, LIST_FORMAT_OPTIONS);
|
|
38
38
|
try {
|
|
39
39
|
var richValues_1 = {};
|
|
40
|
-
var serializedValues = values.map(function (v, i) {
|
|
41
|
-
if (typeof v === 'object') {
|
|
40
|
+
var serializedValues = Array.from(values).map(function (v, i) {
|
|
41
|
+
if (typeof v === 'object' && v !== null) {
|
|
42
42
|
var id = generateToken(i);
|
|
43
43
|
richValues_1[id] = v;
|
|
44
44
|
return id;
|
package/lib/src/types.d.ts
CHANGED
|
@@ -74,9 +74,9 @@ export interface IntlFormatters<TBase = unknown> {
|
|
|
74
74
|
formatMessage<T extends TBase, TValue extends T | FormatXMLElementFn<T>>(this: void, descriptor: MessageDescriptor, values?: Record<string, PrimitiveType | TValue>, opts?: IntlMessageFormatOptions): string | T | Array<string | T>;
|
|
75
75
|
$t(this: void, descriptor: MessageDescriptor, values?: Record<string, PrimitiveType | FormatXMLElementFn<string, string>>, opts?: IntlMessageFormatOptions): string;
|
|
76
76
|
$t<T extends TBase>(this: void, descriptor: MessageDescriptor, values?: Record<string, PrimitiveType | T | FormatXMLElementFn<T>>, opts?: IntlMessageFormatOptions): string | T | (T | string)[];
|
|
77
|
-
formatList(this: void, values:
|
|
78
|
-
formatList<T extends TBase>(this: void, values:
|
|
79
|
-
formatListToParts<T extends TBase>(this: void, values:
|
|
77
|
+
formatList(this: void, values: Iterable<string>, opts?: FormatListOptions): string;
|
|
78
|
+
formatList<T extends TBase>(this: void, values: Iterable<string | T>, opts?: FormatListOptions): T | string | (string | T)[];
|
|
79
|
+
formatListToParts<T extends TBase>(this: void, values: Iterable<string | T>, opts?: FormatListOptions): Part[];
|
|
80
80
|
formatDisplayName(this: void, value: Parameters<Intl.DisplayNames['of']>[0], opts: FormatDisplayNameOptions): string | undefined;
|
|
81
81
|
}
|
|
82
82
|
export interface Formatters {
|
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@formatjs/intl",
|
|
3
3
|
"description": "Internationalize JS apps. This library provides an API to format dates, numbers, and strings, including pluralization and handling translations.",
|
|
4
|
-
"version": "3.1.
|
|
4
|
+
"version": "3.1.8",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Long Ho <holevietlong@gmail.com>",
|
|
7
7
|
"sideEffects": false,
|
|
8
8
|
"dependencies": {
|
|
9
9
|
"tslib": "^2.8.0",
|
|
10
|
-
"@formatjs/icu-messageformat-parser": "2.11.
|
|
11
|
-
"@formatjs/ecma402-abstract": "2.3.
|
|
12
|
-
"intl-messageformat": "10.7.
|
|
10
|
+
"@formatjs/icu-messageformat-parser": "2.11.4",
|
|
11
|
+
"@formatjs/ecma402-abstract": "2.3.6",
|
|
12
|
+
"intl-messageformat": "10.7.18",
|
|
13
13
|
"@formatjs/fast-memoize": "2.2.7"
|
|
14
14
|
},
|
|
15
15
|
"peerDependencies": {
|
package/src/list.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ import { Formatters, IntlFormatters, OnErrorFn, Part } from './types';
|
|
|
2
2
|
export declare function formatList(opts: {
|
|
3
3
|
locale: string;
|
|
4
4
|
onError: OnErrorFn;
|
|
5
|
-
}, getListFormat: Formatters['getListFormat'], values:
|
|
5
|
+
}, getListFormat: Formatters['getListFormat'], values: Iterable<string>, options: Parameters<IntlFormatters['formatList']>[1]): string;
|
|
6
6
|
export declare function formatListToParts<T>(opts: {
|
|
7
7
|
locale: string;
|
|
8
8
|
onError: OnErrorFn;
|
|
9
|
-
}, getListFormat: Formatters['getListFormat'], values:
|
|
9
|
+
}, getListFormat: Formatters['getListFormat'], values: Iterable<string | T>, options: Parameters<IntlFormatters['formatList']>[1]): Part[];
|
package/src/list.js
CHANGED
|
@@ -41,8 +41,8 @@ function formatListToParts(_a, getListFormat, values, options) {
|
|
|
41
41
|
var filteredOptions = (0, utils_1.filterProps)(options, LIST_FORMAT_OPTIONS);
|
|
42
42
|
try {
|
|
43
43
|
var richValues_1 = {};
|
|
44
|
-
var serializedValues = values.map(function (v, i) {
|
|
45
|
-
if (typeof v === 'object') {
|
|
44
|
+
var serializedValues = Array.from(values).map(function (v, i) {
|
|
45
|
+
if (typeof v === 'object' && v !== null) {
|
|
46
46
|
var id = generateToken(i);
|
|
47
47
|
richValues_1[id] = v;
|
|
48
48
|
return id;
|
package/src/types.d.ts
CHANGED
|
@@ -74,9 +74,9 @@ export interface IntlFormatters<TBase = unknown> {
|
|
|
74
74
|
formatMessage<T extends TBase, TValue extends T | FormatXMLElementFn<T>>(this: void, descriptor: MessageDescriptor, values?: Record<string, PrimitiveType | TValue>, opts?: IntlMessageFormatOptions): string | T | Array<string | T>;
|
|
75
75
|
$t(this: void, descriptor: MessageDescriptor, values?: Record<string, PrimitiveType | FormatXMLElementFn<string, string>>, opts?: IntlMessageFormatOptions): string;
|
|
76
76
|
$t<T extends TBase>(this: void, descriptor: MessageDescriptor, values?: Record<string, PrimitiveType | T | FormatXMLElementFn<T>>, opts?: IntlMessageFormatOptions): string | T | (T | string)[];
|
|
77
|
-
formatList(this: void, values:
|
|
78
|
-
formatList<T extends TBase>(this: void, values:
|
|
79
|
-
formatListToParts<T extends TBase>(this: void, values:
|
|
77
|
+
formatList(this: void, values: Iterable<string>, opts?: FormatListOptions): string;
|
|
78
|
+
formatList<T extends TBase>(this: void, values: Iterable<string | T>, opts?: FormatListOptions): T | string | (string | T)[];
|
|
79
|
+
formatListToParts<T extends TBase>(this: void, values: Iterable<string | T>, opts?: FormatListOptions): Part[];
|
|
80
80
|
formatDisplayName(this: void, value: Parameters<Intl.DisplayNames['of']>[0], opts: FormatDisplayNameOptions): string | undefined;
|
|
81
81
|
}
|
|
82
82
|
export interface Formatters {
|