intl-messageformat 8.2.0 → 8.2.1

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/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import IntlMessageFormat from './core';
2
2
  export * from './formatters';
3
3
  export * from './core';
4
+ export * from './error';
4
5
  export default IntlMessageFormat;
package/lib/index.js CHANGED
@@ -6,4 +6,5 @@ See the accompanying LICENSE file for terms.
6
6
  import IntlMessageFormat from './core';
7
7
  export * from './formatters';
8
8
  export * from './core';
9
+ export * from './error';
9
10
  export default IntlMessageFormat;
@@ -3,6 +3,18 @@ import { parse } from 'intl-messageformat-parser';
3
3
 
4
4
  export declare function createDefaultFormatters(cache?: FormatterCache): Formatters;
5
5
 
6
+ export declare const enum ErrorCode {
7
+ MISSING_VALUE = 0,
8
+ INVALID_VALUE = 1,
9
+ MISSING_INTL_API = 2
10
+ }
11
+
12
+ export declare class FormatError extends Error {
13
+ readonly code: ErrorCode;
14
+ constructor(msg: string, code: ErrorCode);
15
+ toString(): string;
16
+ }
17
+
6
18
  export declare interface Formats {
7
19
  number: Record<string, Intl.NumberFormatOptions>;
8
20
  date: Record<string, Intl.DateTimeFormatOptions>;
@@ -101,6 +113,10 @@ declare class IntlMessageFormat {
101
113
  export { IntlMessageFormat }
102
114
  export default IntlMessageFormat;
103
115
 
116
+ export declare class InvalidValueError extends FormatError {
117
+ constructor(variableId: string, value: any, options: string[]);
118
+ }
119
+
104
120
  export declare interface LiteralPart {
105
121
  type: PART_TYPE.literal;
106
122
  value: string;
@@ -108,6 +124,10 @@ export declare interface LiteralPart {
108
124
 
109
125
  export declare type MessageFormatPart<T> = LiteralPart | ObjectPart<T>;
110
126
 
127
+ export declare class MissingValueError extends FormatError {
128
+ constructor(variableId: string, originalMessage?: string);
129
+ }
130
+
111
131
  export declare interface ObjectPart<T = any> {
112
132
  type: PART_TYPE.object;
113
133
  value: T;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "intl-messageformat",
3
- "version": "8.2.0",
3
+ "version": "8.2.1",
4
4
  "description": "Formats ICU Message strings with number, date, plural, and select placeholders to create localized messages.",
5
5
  "keywords": [
6
6
  "i18n",
@@ -58,5 +58,5 @@
58
58
  "test": "tests"
59
59
  },
60
60
  "license": "BSD-3-Clause",
61
- "gitHead": "b262d6d6d7d4914a379ed70f8a369438b7ba5ee6"
61
+ "gitHead": "e0bb34c71e99fd4c68244f3bc668c748b2f18413"
62
62
  }
package/src/index.ts CHANGED
@@ -7,4 +7,5 @@ See the accompanying LICENSE file for terms.
7
7
  import IntlMessageFormat from './core';
8
8
  export * from './formatters';
9
9
  export * from './core';
10
+ export * from './error';
10
11
  export default IntlMessageFormat;