Socket
Socket
Sign inDemoInstall

@formatjs/intl

Package Overview
Dependencies
Maintainers
3
Versions
143
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@formatjs/intl - npm Package Compare versions

Comparing version 1.6.7 to 1.6.8

12

lib/src/dateTime.js
import { __assign } from "tslib";
import { filterProps, getNamedFormat } from './utils';
import { IntlError } from './error';
import { IntlError, IntlErrorCode } from './error';
var DATE_TIME_FORMAT_OPTIONS = [

@@ -54,3 +54,3 @@ 'localeMatcher',

catch (e) {
config.onError(new IntlError("FORMAT_ERROR" /* FORMAT_ERROR */, 'Error formatting date.', e));
config.onError(new IntlError(IntlErrorCode.FORMAT_ERROR, 'Error formatting date.', e));
}

@@ -70,3 +70,3 @@ return String(date);

catch (e) {
config.onError(new IntlError("FORMAT_ERROR" /* FORMAT_ERROR */, 'Error formatting time.', e));
config.onError(new IntlError(IntlErrorCode.FORMAT_ERROR, 'Error formatting time.', e));
}

@@ -87,3 +87,3 @@ return String(date);

catch (e) {
onError(new IntlError("FORMAT_ERROR" /* FORMAT_ERROR */, 'Error formatting date time range.', e));
onError(new IntlError(IntlErrorCode.FORMAT_ERROR, 'Error formatting date time range.', e));
}

@@ -103,3 +103,3 @@ return String(from);

catch (e) {
config.onError(new IntlError("FORMAT_ERROR" /* FORMAT_ERROR */, 'Error formatting date.', e));
config.onError(new IntlError(IntlErrorCode.FORMAT_ERROR, 'Error formatting date.', e));
}

@@ -119,5 +119,5 @@ return [];

catch (e) {
config.onError(new IntlError("FORMAT_ERROR" /* FORMAT_ERROR */, 'Error formatting time.', e));
config.onError(new IntlError(IntlErrorCode.FORMAT_ERROR, 'Error formatting time.', e));
}
return [];
}
import { filterProps } from './utils';
import { FormatError } from 'intl-messageformat';
import { IntlError } from './error';
import { IntlErrorCode, IntlError } from './error';
var DISPLAY_NAMES_OPTONS = [

@@ -21,4 +21,4 @@ 'localeMatcher',

catch (e) {
onError(new IntlError("FORMAT_ERROR" /* FORMAT_ERROR */, 'Error formatting display name.', e));
onError(new IntlError(IntlErrorCode.FORMAT_ERROR, 'Error formatting display name.', e));
}
}
import { MessageDescriptor } from './types';
export declare const enum IntlErrorCode {
export declare enum IntlErrorCode {
FORMAT_ERROR = "FORMAT_ERROR",

@@ -4,0 +4,0 @@ UNSUPPORTED_FORMATTER = "UNSUPPORTED_FORMATTER",

@@ -26,3 +26,3 @@ import { __extends } from "tslib";

function UnsupportedFormatterError(message, exception) {
return _super.call(this, "UNSUPPORTED_FORMATTER" /* UNSUPPORTED_FORMATTER */, message, exception) || this;
return _super.call(this, IntlErrorCode.UNSUPPORTED_FORMATTER, message, exception) || this;
}

@@ -35,3 +35,3 @@ return UnsupportedFormatterError;

function InvalidConfigError(message, exception) {
return _super.call(this, "INVALID_CONFIG" /* INVALID_CONFIG */, message, exception) || this;
return _super.call(this, IntlErrorCode.INVALID_CONFIG, message, exception) || this;
}

@@ -44,3 +44,3 @@ return InvalidConfigError;

function MissingDataError(message, exception) {
return _super.call(this, "MISSING_DATA" /* MISSING_DATA */, message, exception) || this;
return _super.call(this, IntlErrorCode.MISSING_DATA, message, exception) || this;
}

@@ -53,3 +53,3 @@ return MissingDataError;

function MessageFormatError(message, locale, descriptor, exception) {
var _this = _super.call(this, "FORMAT_ERROR" /* FORMAT_ERROR */, message + " \nLocale: " + locale + "\nMessageID: " + (descriptor === null || descriptor === void 0 ? void 0 : descriptor.id) + "\nDefault Message: " + (descriptor === null || descriptor === void 0 ? void 0 : descriptor.defaultMessage) + "\nDescription: " + (descriptor === null || descriptor === void 0 ? void 0 : descriptor.description) + " \n", exception) || this;
var _this = _super.call(this, IntlErrorCode.FORMAT_ERROR, message + " \nLocale: " + locale + "\nMessageID: " + (descriptor === null || descriptor === void 0 ? void 0 : descriptor.id) + "\nDefault Message: " + (descriptor === null || descriptor === void 0 ? void 0 : descriptor.defaultMessage) + "\nDescription: " + (descriptor === null || descriptor === void 0 ? void 0 : descriptor.description) + " \n", exception) || this;
_this.descriptor = descriptor;

@@ -64,3 +64,3 @@ return _this;

function MissingTranslationError(descriptor, locale) {
var _this = _super.call(this, "MISSING_TRANSLATION" /* MISSING_TRANSLATION */, "Missing message: \"" + descriptor.id + "\" for locale \"" + locale + "\", using " + (descriptor.defaultMessage ? 'default message' : 'id') + " as fallback.") || this;
var _this = _super.call(this, IntlErrorCode.MISSING_TRANSLATION, "Missing message: \"" + descriptor.id + "\" for locale \"" + locale + "\", using " + (descriptor.defaultMessage ? 'default message' : 'id') + " as fallback.") || this;
_this.descriptor = descriptor;

@@ -67,0 +67,0 @@ return _this;

import { filterProps } from './utils';
import { FormatError } from 'intl-messageformat';
import { IntlError } from './error';
import { IntlError, IntlErrorCode } from './error';
var LIST_FORMAT_OPTIONS = [

@@ -50,3 +50,3 @@ 'localeMatcher',

catch (e) {
onError(new IntlError("FORMAT_ERROR" /* FORMAT_ERROR */, 'Error formatting list.', e));
onError(new IntlError(IntlErrorCode.FORMAT_ERROR, 'Error formatting list.', e));
}

@@ -53,0 +53,0 @@ // @ts-ignore

import { getNamedFormat, filterProps } from './utils';
import { IntlError } from './error';
import { IntlError, IntlErrorCode } from './error';
var NUMBER_FORMAT_OPTIONS = [

@@ -41,3 +41,3 @@ 'localeMatcher',

catch (e) {
config.onError(new IntlError("FORMAT_ERROR" /* FORMAT_ERROR */, 'Error formatting number.', e));
config.onError(new IntlError(IntlErrorCode.FORMAT_ERROR, 'Error formatting number.', e));
}

@@ -52,5 +52,5 @@ return String(value);

catch (e) {
config.onError(new IntlError("FORMAT_ERROR" /* FORMAT_ERROR */, 'Error formatting number.', e));
config.onError(new IntlError(IntlErrorCode.FORMAT_ERROR, 'Error formatting number.', e));
}
return [];
}
{
"name": "@formatjs/intl",
"version": "1.6.7",
"version": "1.6.8",
"description": "Internationalize JS apps. This library provides an API to format dates, numbers, and strings, including pluralization and handling translations.",

@@ -38,6 +38,6 @@ "keywords": [

"fast-memoize": "^2.5.2",
"intl-messageformat": "9.4.6",
"intl-messageformat-parser": "6.3.1",
"intl-messageformat": "9.4.7",
"intl-messageformat-parser": "6.3.2",
"tslib": "^2.0.1"
}
}

@@ -58,3 +58,3 @@ "use strict";

catch (e) {
config.onError(new error_1.IntlError("FORMAT_ERROR" /* FORMAT_ERROR */, 'Error formatting date.', e));
config.onError(new error_1.IntlError(error_1.IntlErrorCode.FORMAT_ERROR, 'Error formatting date.', e));
}

@@ -75,3 +75,3 @@ return String(date);

catch (e) {
config.onError(new error_1.IntlError("FORMAT_ERROR" /* FORMAT_ERROR */, 'Error formatting time.', e));
config.onError(new error_1.IntlError(error_1.IntlErrorCode.FORMAT_ERROR, 'Error formatting time.', e));
}

@@ -93,3 +93,3 @@ return String(date);

catch (e) {
onError(new error_1.IntlError("FORMAT_ERROR" /* FORMAT_ERROR */, 'Error formatting date time range.', e));
onError(new error_1.IntlError(error_1.IntlErrorCode.FORMAT_ERROR, 'Error formatting date time range.', e));
}

@@ -110,3 +110,3 @@ return String(from);

catch (e) {
config.onError(new error_1.IntlError("FORMAT_ERROR" /* FORMAT_ERROR */, 'Error formatting date.', e));
config.onError(new error_1.IntlError(error_1.IntlErrorCode.FORMAT_ERROR, 'Error formatting date.', e));
}

@@ -127,3 +127,3 @@ return [];

catch (e) {
config.onError(new error_1.IntlError("FORMAT_ERROR" /* FORMAT_ERROR */, 'Error formatting time.', e));
config.onError(new error_1.IntlError(error_1.IntlErrorCode.FORMAT_ERROR, 'Error formatting time.', e));
}

@@ -130,0 +130,0 @@ return [];

@@ -24,5 +24,5 @@ "use strict";

catch (e) {
onError(new error_1.IntlError("FORMAT_ERROR" /* FORMAT_ERROR */, 'Error formatting display name.', e));
onError(new error_1.IntlError(error_1.IntlErrorCode.FORMAT_ERROR, 'Error formatting display name.', e));
}
}
exports.formatDisplayName = formatDisplayName;
import { MessageDescriptor } from './types';
export declare const enum IntlErrorCode {
export declare enum IntlErrorCode {
FORMAT_ERROR = "FORMAT_ERROR",

@@ -4,0 +4,0 @@ UNSUPPORTED_FORMATTER = "UNSUPPORTED_FORMATTER",

@@ -29,3 +29,3 @@ "use strict";

function UnsupportedFormatterError(message, exception) {
return _super.call(this, "UNSUPPORTED_FORMATTER" /* UNSUPPORTED_FORMATTER */, message, exception) || this;
return _super.call(this, IntlErrorCode.UNSUPPORTED_FORMATTER, message, exception) || this;
}

@@ -38,3 +38,3 @@ return UnsupportedFormatterError;

function InvalidConfigError(message, exception) {
return _super.call(this, "INVALID_CONFIG" /* INVALID_CONFIG */, message, exception) || this;
return _super.call(this, IntlErrorCode.INVALID_CONFIG, message, exception) || this;
}

@@ -47,3 +47,3 @@ return InvalidConfigError;

function MissingDataError(message, exception) {
return _super.call(this, "MISSING_DATA" /* MISSING_DATA */, message, exception) || this;
return _super.call(this, IntlErrorCode.MISSING_DATA, message, exception) || this;
}

@@ -56,3 +56,3 @@ return MissingDataError;

function MessageFormatError(message, locale, descriptor, exception) {
var _this = _super.call(this, "FORMAT_ERROR" /* FORMAT_ERROR */, message + " \nLocale: " + locale + "\nMessageID: " + (descriptor === null || descriptor === void 0 ? void 0 : descriptor.id) + "\nDefault Message: " + (descriptor === null || descriptor === void 0 ? void 0 : descriptor.defaultMessage) + "\nDescription: " + (descriptor === null || descriptor === void 0 ? void 0 : descriptor.description) + " \n", exception) || this;
var _this = _super.call(this, IntlErrorCode.FORMAT_ERROR, message + " \nLocale: " + locale + "\nMessageID: " + (descriptor === null || descriptor === void 0 ? void 0 : descriptor.id) + "\nDefault Message: " + (descriptor === null || descriptor === void 0 ? void 0 : descriptor.defaultMessage) + "\nDescription: " + (descriptor === null || descriptor === void 0 ? void 0 : descriptor.description) + " \n", exception) || this;
_this.descriptor = descriptor;

@@ -67,3 +67,3 @@ return _this;

function MissingTranslationError(descriptor, locale) {
var _this = _super.call(this, "MISSING_TRANSLATION" /* MISSING_TRANSLATION */, "Missing message: \"" + descriptor.id + "\" for locale \"" + locale + "\", using " + (descriptor.defaultMessage ? 'default message' : 'id') + " as fallback.") || this;
var _this = _super.call(this, IntlErrorCode.MISSING_TRANSLATION, "Missing message: \"" + descriptor.id + "\" for locale \"" + locale + "\", using " + (descriptor.defaultMessage ? 'default message' : 'id') + " as fallback.") || this;
_this.descriptor = descriptor;

@@ -70,0 +70,0 @@ return _this;

@@ -53,3 +53,3 @@ "use strict";

catch (e) {
onError(new error_1.IntlError("FORMAT_ERROR" /* FORMAT_ERROR */, 'Error formatting list.', e));
onError(new error_1.IntlError(error_1.IntlErrorCode.FORMAT_ERROR, 'Error formatting list.', e));
}

@@ -56,0 +56,0 @@ // @ts-ignore

@@ -45,3 +45,3 @@ "use strict";

catch (e) {
config.onError(new error_1.IntlError("FORMAT_ERROR" /* FORMAT_ERROR */, 'Error formatting number.', e));
config.onError(new error_1.IntlError(error_1.IntlErrorCode.FORMAT_ERROR, 'Error formatting number.', e));
}

@@ -57,3 +57,3 @@ return String(value);

catch (e) {
config.onError(new error_1.IntlError("FORMAT_ERROR" /* FORMAT_ERROR */, 'Error formatting number.', e));
config.onError(new error_1.IntlError(error_1.IntlErrorCode.FORMAT_ERROR, 'Error formatting number.', 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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc