@formatjs/intl
Advanced tools
Comparing version 2.6.9 to 2.7.0
import { __assign } from "tslib"; | ||
import { filterProps, getNamedFormat } from './utils'; | ||
import { IntlError, IntlErrorCode } from './error'; | ||
import { IntlFormatError } from './error'; | ||
var DATE_TIME_FORMAT_OPTIONS = [ | ||
@@ -53,3 +53,3 @@ 'formatMatcher', | ||
catch (e) { | ||
config.onError(new IntlError(IntlErrorCode.FORMAT_ERROR, 'Error formatting date.', e)); | ||
config.onError(new IntlFormatError('Error formatting date.', config.locale, e)); | ||
} | ||
@@ -69,3 +69,3 @@ return String(date); | ||
catch (e) { | ||
config.onError(new IntlError(IntlErrorCode.FORMAT_ERROR, 'Error formatting time.', e)); | ||
config.onError(new IntlFormatError('Error formatting time.', config.locale, e)); | ||
} | ||
@@ -86,3 +86,3 @@ return String(date); | ||
catch (e) { | ||
onError(new IntlError(IntlErrorCode.FORMAT_ERROR, 'Error formatting date time range.', e)); | ||
onError(new IntlFormatError('Error formatting date time range.', config.locale, e)); | ||
} | ||
@@ -102,3 +102,3 @@ return String(from); | ||
catch (e) { | ||
config.onError(new IntlError(IntlErrorCode.FORMAT_ERROR, 'Error formatting date.', e)); | ||
config.onError(new IntlFormatError('Error formatting date.', config.locale, e)); | ||
} | ||
@@ -118,5 +118,5 @@ return []; | ||
catch (e) { | ||
config.onError(new IntlError(IntlErrorCode.FORMAT_ERROR, 'Error formatting time.', e)); | ||
config.onError(new IntlFormatError('Error formatting time.', config.locale, e)); | ||
} | ||
return []; | ||
} |
import { filterProps } from './utils'; | ||
import { FormatError, ErrorCode } from 'intl-messageformat'; | ||
import { IntlErrorCode, IntlError } from './error'; | ||
import { IntlFormatError } from './error'; | ||
var DISPLAY_NAMES_OPTONS = [ | ||
@@ -21,4 +21,4 @@ 'style', | ||
catch (e) { | ||
onError(new IntlError(IntlErrorCode.FORMAT_ERROR, 'Error formatting display name.', e)); | ||
onError(new IntlFormatError('Error formatting display name.', locale, e)); | ||
} | ||
} |
@@ -24,2 +24,3 @@ import { MessageDescriptor } from './types'; | ||
readonly descriptor?: MessageDescriptor; | ||
readonly locale: string; | ||
constructor(message: string, locale: string, exception?: Error | unknown); | ||
@@ -29,2 +30,3 @@ } | ||
readonly descriptor?: MessageDescriptor; | ||
readonly locale: string; | ||
constructor(message: string, locale: string, descriptor?: MessageDescriptor, exception?: Error | unknown); | ||
@@ -31,0 +33,0 @@ } |
@@ -58,3 +58,5 @@ import { __extends } from "tslib"; | ||
function IntlFormatError(message, locale, exception) { | ||
return _super.call(this, IntlErrorCode.FORMAT_ERROR, "".concat(message, "\nLocale: ").concat(locale, "\n"), exception) || this; | ||
var _this = _super.call(this, IntlErrorCode.FORMAT_ERROR, "".concat(message, "\nLocale: ").concat(locale, "\n"), exception) || this; | ||
_this.locale = locale; | ||
return _this; | ||
} | ||
@@ -69,2 +71,3 @@ return IntlFormatError; | ||
_this.descriptor = descriptor; | ||
_this.locale = locale; | ||
return _this; | ||
@@ -71,0 +74,0 @@ } |
import { __assign } from "tslib"; | ||
import { filterProps } from './utils'; | ||
import { FormatError, ErrorCode } from 'intl-messageformat'; | ||
import { IntlError, IntlErrorCode } from './error'; | ||
import { IntlFormatError } from './error'; | ||
var LIST_FORMAT_OPTIONS = [ | ||
@@ -57,3 +57,3 @@ 'type', | ||
catch (e) { | ||
onError(new IntlError(IntlErrorCode.FORMAT_ERROR, 'Error formatting list.', e)); | ||
onError(new IntlFormatError('Error formatting list.', locale, e)); | ||
} | ||
@@ -60,0 +60,0 @@ // @ts-ignore |
import { getNamedFormat, filterProps } from './utils'; | ||
import { IntlError, IntlErrorCode } from './error'; | ||
import { IntlFormatError } from './error'; | ||
var NUMBER_FORMAT_OPTIONS = [ | ||
@@ -41,3 +41,3 @@ 'style', | ||
catch (e) { | ||
config.onError(new IntlError(IntlErrorCode.FORMAT_ERROR, 'Error formatting number.', e)); | ||
config.onError(new IntlFormatError('Error formatting number.', config.locale, e)); | ||
} | ||
@@ -52,5 +52,5 @@ return String(value); | ||
catch (e) { | ||
config.onError(new IntlError(IntlErrorCode.FORMAT_ERROR, 'Error formatting number.', e)); | ||
config.onError(new IntlFormatError('Error formatting number.', config.locale, e)); | ||
} | ||
return []; | ||
} |
{ | ||
"name": "@formatjs/intl", | ||
"version": "2.6.9", | ||
"version": "2.7.0", | ||
"description": "Internationalize JS apps. This library provides an API to format dates, numbers, and strings, including pluralization and handling translations.", | ||
@@ -34,14 +34,14 @@ "keywords": [ | ||
"@formatjs/fast-memoize": "2.0.1", | ||
"@formatjs/icu-messageformat-parser": "2.3.0", | ||
"@formatjs/intl-displaynames": "6.2.6", | ||
"@formatjs/intl-listformat": "7.1.9", | ||
"intl-messageformat": "10.3.3", | ||
"@formatjs/icu-messageformat-parser": "2.3.1", | ||
"@formatjs/intl-displaynames": "6.3.0", | ||
"@formatjs/intl-listformat": "7.2.0", | ||
"intl-messageformat": "10.3.4", | ||
"tslib": "^2.4.0" | ||
}, | ||
"devDependencies": { | ||
"@formatjs/intl-datetimeformat": "6.5.1", | ||
"@formatjs/intl-numberformat": "8.3.5" | ||
"@formatjs/intl-datetimeformat": "6.6.0", | ||
"@formatjs/intl-numberformat": "8.4.0" | ||
}, | ||
"peerDependencies": { | ||
"typescript": "^4.7" | ||
"typescript": "^4.7 || 5" | ||
}, | ||
@@ -48,0 +48,0 @@ "peerDependenciesMeta": { |
@@ -57,3 +57,3 @@ "use strict"; | ||
catch (e) { | ||
config.onError(new error_1.IntlError(error_1.IntlErrorCode.FORMAT_ERROR, 'Error formatting date.', e)); | ||
config.onError(new error_1.IntlFormatError('Error formatting date.', config.locale, e)); | ||
} | ||
@@ -74,3 +74,3 @@ return String(date); | ||
catch (e) { | ||
config.onError(new error_1.IntlError(error_1.IntlErrorCode.FORMAT_ERROR, 'Error formatting time.', e)); | ||
config.onError(new error_1.IntlFormatError('Error formatting time.', config.locale, e)); | ||
} | ||
@@ -92,3 +92,3 @@ return String(date); | ||
catch (e) { | ||
onError(new error_1.IntlError(error_1.IntlErrorCode.FORMAT_ERROR, 'Error formatting date time range.', e)); | ||
onError(new error_1.IntlFormatError('Error formatting date time range.', config.locale, e)); | ||
} | ||
@@ -109,3 +109,3 @@ return String(from); | ||
catch (e) { | ||
config.onError(new error_1.IntlError(error_1.IntlErrorCode.FORMAT_ERROR, 'Error formatting date.', e)); | ||
config.onError(new error_1.IntlFormatError('Error formatting date.', config.locale, e)); | ||
} | ||
@@ -126,3 +126,3 @@ return []; | ||
catch (e) { | ||
config.onError(new error_1.IntlError(error_1.IntlErrorCode.FORMAT_ERROR, 'Error formatting time.', e)); | ||
config.onError(new error_1.IntlFormatError('Error formatting time.', config.locale, e)); | ||
} | ||
@@ -129,0 +129,0 @@ return []; |
@@ -24,5 +24,5 @@ "use strict"; | ||
catch (e) { | ||
onError(new error_1.IntlError(error_1.IntlErrorCode.FORMAT_ERROR, 'Error formatting display name.', e)); | ||
onError(new error_1.IntlFormatError('Error formatting display name.', locale, e)); | ||
} | ||
} | ||
exports.formatDisplayName = formatDisplayName; |
@@ -24,2 +24,3 @@ import { MessageDescriptor } from './types'; | ||
readonly descriptor?: MessageDescriptor; | ||
readonly locale: string; | ||
constructor(message: string, locale: string, exception?: Error | unknown); | ||
@@ -29,2 +30,3 @@ } | ||
readonly descriptor?: MessageDescriptor; | ||
readonly locale: string; | ||
constructor(message: string, locale: string, descriptor?: MessageDescriptor, exception?: Error | unknown); | ||
@@ -31,0 +33,0 @@ } |
@@ -61,3 +61,5 @@ "use strict"; | ||
function IntlFormatError(message, locale, exception) { | ||
return _super.call(this, IntlErrorCode.FORMAT_ERROR, "".concat(message, "\nLocale: ").concat(locale, "\n"), exception) || this; | ||
var _this = _super.call(this, IntlErrorCode.FORMAT_ERROR, "".concat(message, "\nLocale: ").concat(locale, "\n"), exception) || this; | ||
_this.locale = locale; | ||
return _this; | ||
} | ||
@@ -72,2 +74,3 @@ return IntlFormatError; | ||
_this.descriptor = descriptor; | ||
_this.locale = locale; | ||
return _this; | ||
@@ -74,0 +77,0 @@ } |
@@ -61,3 +61,3 @@ "use strict"; | ||
catch (e) { | ||
onError(new error_1.IntlError(error_1.IntlErrorCode.FORMAT_ERROR, 'Error formatting list.', e)); | ||
onError(new error_1.IntlFormatError('Error formatting list.', locale, e)); | ||
} | ||
@@ -64,0 +64,0 @@ // @ts-ignore |
@@ -45,3 +45,3 @@ "use strict"; | ||
catch (e) { | ||
config.onError(new error_1.IntlError(error_1.IntlErrorCode.FORMAT_ERROR, 'Error formatting number.', e)); | ||
config.onError(new error_1.IntlFormatError('Error formatting number.', config.locale, e)); | ||
} | ||
@@ -57,3 +57,3 @@ return String(value); | ||
catch (e) { | ||
config.onError(new error_1.IntlError(error_1.IntlErrorCode.FORMAT_ERROR, 'Error formatting number.', e)); | ||
config.onError(new error_1.IntlFormatError('Error formatting number.', config.locale, e)); | ||
} | ||
@@ -60,0 +60,0 @@ return []; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
141083
2103
+ Added@formatjs/icu-messageformat-parser@2.3.1(transitive)
+ Added@formatjs/intl-displaynames@6.3.0(transitive)
+ Added@formatjs/intl-listformat@7.2.0(transitive)
+ Addedintl-messageformat@10.3.4(transitive)
+ Addedtypescript@5.6.3(transitive)
- Removed@formatjs/icu-messageformat-parser@2.3.0(transitive)
- Removed@formatjs/intl-displaynames@6.2.6(transitive)
- Removed@formatjs/intl-listformat@7.1.9(transitive)
- Removedintl-messageformat@10.3.3(transitive)
- Removedtypescript@4.9.5(transitive)
Updatedintl-messageformat@10.3.4