Socket
Socket
Sign inDemoInstall

@formatjs/intl-listformat

Package Overview
Dependencies
3
Maintainers
3
Versions
140
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 6.3.5 to 6.3.6

58

index.js

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

if (!(instance instanceof ListFormat)) {
throw new TypeError("Method Intl.ListFormat.prototype." + method + " called on incompatible receiver " + String(instance));
throw new TypeError("Method Intl.ListFormat.prototype.".concat(method, " called on incompatible receiver ").concat(String(instance)));
}

@@ -24,3 +24,3 @@ }

if (typeof el !== 'string') {
throw new TypeError("array list[" + list.indexOf(el) + "] is not type String");
throw new TypeError("array list[".concat(list.indexOf(el), "] is not type String"));
}

@@ -37,3 +37,3 @@ result.push(el);

if (size === 2) {
var pattern = ecma402_abstract_1.getInternalSlot(internalSlotMap, lf, 'templatePair');
var pattern = (0, ecma402_abstract_1.getInternalSlot)(internalSlotMap, lf, 'templatePair');
var first = { type: 'element', value: list[0] };

@@ -52,9 +52,9 @@ var second = { type: 'element', value: list[1] };

if (i === 0) {
pattern = ecma402_abstract_1.getInternalSlot(internalSlotMap, lf, 'templateStart');
pattern = (0, ecma402_abstract_1.getInternalSlot)(internalSlotMap, lf, 'templateStart');
}
else if (i < size - 2) {
pattern = ecma402_abstract_1.getInternalSlot(internalSlotMap, lf, 'templateMiddle');
pattern = (0, ecma402_abstract_1.getInternalSlot)(internalSlotMap, lf, 'templateMiddle');
}
else {
pattern = ecma402_abstract_1.getInternalSlot(internalSlotMap, lf, 'templateEnd');
pattern = (0, ecma402_abstract_1.getInternalSlot)(internalSlotMap, lf, 'templateEnd');
}

@@ -68,3 +68,3 @@ var head = { type: 'element', value: list[i] };

function deconstructPattern(pattern, placeables) {
var patternParts = ecma402_abstract_1.PartitionPattern(pattern);
var patternParts = (0, ecma402_abstract_1.PartitionPattern)(pattern);
var result = [];

@@ -74,3 +74,3 @@ for (var _i = 0, patternParts_1 = patternParts; _i < patternParts_1.length; _i++) {

var part = patternPart.type;
if (ecma402_abstract_1.isLiteralPart(patternPart)) {
if ((0, ecma402_abstract_1.isLiteralPart)(patternPart)) {
result.push({

@@ -82,3 +82,3 @@ type: 'literal',

else {
ecma402_abstract_1.invariant(part in placeables, part + " is missing from placables");
(0, ecma402_abstract_1.invariant)(part in placeables, "".concat(part, " is missing from placables"));
var subst = placeables[part];

@@ -103,24 +103,24 @@ if (Array.isArray(subst)) {

}
ecma402_abstract_1.setInternalSlot(ListFormat.__INTERNAL_SLOT_MAP__, this, 'initializedListFormat', true);
var requestedLocales = ecma402_abstract_1.CanonicalizeLocaleList(locales);
(0, ecma402_abstract_1.setInternalSlot)(ListFormat.__INTERNAL_SLOT_MAP__, this, 'initializedListFormat', true);
var requestedLocales = (0, ecma402_abstract_1.CanonicalizeLocaleList)(locales);
var opt = Object.create(null);
var opts = ecma402_abstract_1.GetOptionsObject(options);
var matcher = ecma402_abstract_1.GetOption(opts, 'localeMatcher', 'string', ['best fit', 'lookup'], 'best fit');
var opts = (0, ecma402_abstract_1.GetOptionsObject)(options);
var matcher = (0, ecma402_abstract_1.GetOption)(opts, 'localeMatcher', 'string', ['best fit', 'lookup'], 'best fit');
opt.localeMatcher = matcher;
var localeData = ListFormat.localeData;
var r = intl_localematcher_1.ResolveLocale(ListFormat.availableLocales, requestedLocales, opt, ListFormat.relevantExtensionKeys, localeData, ListFormat.getDefaultLocale);
ecma402_abstract_1.setInternalSlot(ListFormat.__INTERNAL_SLOT_MAP__, this, 'locale', r.locale);
var type = ecma402_abstract_1.GetOption(opts, 'type', 'string', ['conjunction', 'disjunction', 'unit'], 'conjunction');
ecma402_abstract_1.setInternalSlot(ListFormat.__INTERNAL_SLOT_MAP__, this, 'type', type);
var style = ecma402_abstract_1.GetOption(opts, 'style', 'string', ['long', 'short', 'narrow'], 'long');
ecma402_abstract_1.setInternalSlot(ListFormat.__INTERNAL_SLOT_MAP__, this, 'style', style);
var r = (0, intl_localematcher_1.ResolveLocale)(ListFormat.availableLocales, requestedLocales, opt, ListFormat.relevantExtensionKeys, localeData, ListFormat.getDefaultLocale);
(0, ecma402_abstract_1.setInternalSlot)(ListFormat.__INTERNAL_SLOT_MAP__, this, 'locale', r.locale);
var type = (0, ecma402_abstract_1.GetOption)(opts, 'type', 'string', ['conjunction', 'disjunction', 'unit'], 'conjunction');
(0, ecma402_abstract_1.setInternalSlot)(ListFormat.__INTERNAL_SLOT_MAP__, this, 'type', type);
var style = (0, ecma402_abstract_1.GetOption)(opts, 'style', 'string', ['long', 'short', 'narrow'], 'long');
(0, ecma402_abstract_1.setInternalSlot)(ListFormat.__INTERNAL_SLOT_MAP__, this, 'style', style);
var dataLocale = r.dataLocale;
var dataLocaleData = localeData[dataLocale];
ecma402_abstract_1.invariant(!!dataLocaleData, "Missing locale data for " + dataLocale);
(0, ecma402_abstract_1.invariant)(!!dataLocaleData, "Missing locale data for ".concat(dataLocale));
var dataLocaleTypes = dataLocaleData[type];
var templates = dataLocaleTypes[style];
ecma402_abstract_1.setInternalSlot(ListFormat.__INTERNAL_SLOT_MAP__, this, 'templatePair', templates.pair);
ecma402_abstract_1.setInternalSlot(ListFormat.__INTERNAL_SLOT_MAP__, this, 'templateStart', templates.start);
ecma402_abstract_1.setInternalSlot(ListFormat.__INTERNAL_SLOT_MAP__, this, 'templateMiddle', templates.middle);
ecma402_abstract_1.setInternalSlot(ListFormat.__INTERNAL_SLOT_MAP__, this, 'templateEnd', templates.end);
(0, ecma402_abstract_1.setInternalSlot)(ListFormat.__INTERNAL_SLOT_MAP__, this, 'templatePair', templates.pair);
(0, ecma402_abstract_1.setInternalSlot)(ListFormat.__INTERNAL_SLOT_MAP__, this, 'templateStart', templates.start);
(0, ecma402_abstract_1.setInternalSlot)(ListFormat.__INTERNAL_SLOT_MAP__, this, 'templateMiddle', templates.middle);
(0, ecma402_abstract_1.setInternalSlot)(ListFormat.__INTERNAL_SLOT_MAP__, this, 'templateEnd', templates.end);
}

@@ -149,3 +149,3 @@ ListFormat.prototype.format = function (elements) {

var part = parts_2[_i];
result.push(tslib_1.__assign({}, part));
result.push((0, tslib_1.__assign)({}, part));
}

@@ -157,5 +157,5 @@ return result;

return {
locale: ecma402_abstract_1.getInternalSlot(ListFormat.__INTERNAL_SLOT_MAP__, this, 'locale'),
type: ecma402_abstract_1.getInternalSlot(ListFormat.__INTERNAL_SLOT_MAP__, this, 'type'),
style: ecma402_abstract_1.getInternalSlot(ListFormat.__INTERNAL_SLOT_MAP__, this, 'style'),
locale: (0, ecma402_abstract_1.getInternalSlot)(ListFormat.__INTERNAL_SLOT_MAP__, this, 'locale'),
type: (0, ecma402_abstract_1.getInternalSlot)(ListFormat.__INTERNAL_SLOT_MAP__, this, 'type'),
style: (0, ecma402_abstract_1.getInternalSlot)(ListFormat.__INTERNAL_SLOT_MAP__, this, 'style'),
};

@@ -165,3 +165,3 @@ };

// test262/test/intl402/ListFormat/constructor/supportedLocalesOf/result-type.js
return ecma402_abstract_1.SupportedLocales(ListFormat.availableLocales, ecma402_abstract_1.CanonicalizeLocaleList(locales), options);
return (0, ecma402_abstract_1.SupportedLocales)(ListFormat.availableLocales, (0, ecma402_abstract_1.CanonicalizeLocaleList)(locales), options);
};

@@ -168,0 +168,0 @@ ListFormat.__addLocaleData = function () {

@@ -6,3 +6,3 @@ import { __assign } from "tslib";

if (!(instance instanceof ListFormat)) {
throw new TypeError("Method Intl.ListFormat.prototype." + method + " called on incompatible receiver " + String(instance));
throw new TypeError("Method Intl.ListFormat.prototype.".concat(method, " called on incompatible receiver ").concat(String(instance)));
}

@@ -22,3 +22,3 @@ }

if (typeof el !== 'string') {
throw new TypeError("array list[" + list.indexOf(el) + "] is not type String");
throw new TypeError("array list[".concat(list.indexOf(el), "] is not type String"));
}

@@ -76,3 +76,3 @@ result.push(el);

else {
invariant(part in placeables, part + " is missing from placables");
invariant(part in placeables, "".concat(part, " is missing from placables"));
var subst = placeables[part];

@@ -112,3 +112,3 @@ if (Array.isArray(subst)) {

var dataLocaleData = localeData[dataLocale];
invariant(!!dataLocaleData, "Missing locale data for " + dataLocale);
invariant(!!dataLocaleData, "Missing locale data for ".concat(dataLocale));
var dataLocaleTypes = dataLocaleData[type];

@@ -115,0 +115,0 @@ var templates = dataLocaleTypes[style];

{
"name": "@formatjs/intl-listformat",
"version": "6.3.5",
"version": "6.3.6",
"description": "Formats JS list in a i18n-safe way",

@@ -22,3 +22,3 @@ "keywords": [

"dependencies": {
"@formatjs/ecma402-abstract": "1.10.0",
"@formatjs/ecma402-abstract": "1.11.0",
"@formatjs/intl-localematcher": "0.2.21",

@@ -25,0 +25,0 @@ "tslib": "^2.1.0"

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var _1 = tslib_1.__importDefault(require("./"));
var _1 = (0, tslib_1.__importDefault)(require("./"));
Object.defineProperty(Intl, 'ListFormat', {

@@ -6,0 +6,0 @@ value: _1.default,

@@ -11,7 +11,4 @@ (function() {

};
var __require = typeof require !== "undefined" ? require : function(x) {
throw new Error('Dynamic require of "' + x + '" is not supported');
};
var __commonJS = function(cb, mod) {
return function __require2() {
return function __require() {
return mod || (0, cb[Object.keys(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;

@@ -95,3 +92,3 @@ };

var noExtensionLocale = locale.replace(utils_1.UNICODE_EXTENSION_SEQUENCE_REGEX, "");
var availableLocale = BestAvailableLocale_1.BestAvailableLocale(availableLocales, noExtensionLocale);
var availableLocale = (0, BestAvailableLocale_1.BestAvailableLocale)(availableLocales, noExtensionLocale);
if (availableLocale) {

@@ -153,3 +150,3 @@ result.locale = availableLocale;

}
foundLocale = BestAvailableLocale_1.BestAvailableLocale(minimizedAvailableLocales, maximizedRequestedLocale);
foundLocale = (0, BestAvailableLocale_1.BestAvailableLocale)(minimizedAvailableLocales, maximizedRequestedLocale);
}

@@ -172,5 +169,5 @@ return {

function UnicodeExtensionValue(extension, key) {
utils_1.invariant(key.length === 2, "key must have 2 elements");
(0, utils_1.invariant)(key.length === 2, "key must have 2 elements");
var size = extension.length;
var searchValue = "-" + key + "-";
var searchValue = "-".concat(key, "-");
var pos = extension.indexOf(searchValue);

@@ -202,3 +199,3 @@ if (pos !== -1) {

}
searchValue = "-" + key;
searchValue = "-".concat(key);
pos = extension.indexOf(searchValue);

@@ -228,5 +225,5 @@ if (pos !== -1 && pos + 3 === size) {

if (matcher === "lookup") {
r = LookupMatcher_1.LookupMatcher(availableLocales, requestedLocales, getDefaultLocale);
r = (0, LookupMatcher_1.LookupMatcher)(availableLocales, requestedLocales, getDefaultLocale);
} else {
r = BestFitMatcher_1.BestFitMatcher(availableLocales, requestedLocales, getDefaultLocale);
r = (0, BestFitMatcher_1.BestFitMatcher)(availableLocales, requestedLocales, getDefaultLocale);
}

@@ -238,12 +235,12 @@ var foundLocale = r.locale;

var key = relevantExtensionKeys_1[_i];
utils_1.invariant(foundLocale in localeData, "Missing locale data for " + foundLocale);
(0, utils_1.invariant)(foundLocale in localeData, "Missing locale data for ".concat(foundLocale));
var foundLocaleData = localeData[foundLocale];
utils_1.invariant(typeof foundLocaleData === "object" && foundLocaleData !== null, "locale data " + key + " must be an object");
(0, utils_1.invariant)(typeof foundLocaleData === "object" && foundLocaleData !== null, "locale data ".concat(key, " must be an object"));
var keyLocaleData = foundLocaleData[key];
utils_1.invariant(Array.isArray(keyLocaleData), "keyLocaleData for " + key + " must be an array");
(0, utils_1.invariant)(Array.isArray(keyLocaleData), "keyLocaleData for ".concat(key, " must be an array"));
var value = keyLocaleData[0];
utils_1.invariant(typeof value === "string" || value === null, "value must be string or null but got " + typeof value + " in key " + key);
(0, utils_1.invariant)(typeof value === "string" || value === null, "value must be string or null but got ".concat(typeof value, " in key ").concat(key));
var supportedExtensionAddition = "";
if (r.extension) {
var requestedValue = UnicodeExtensionValue_1.UnicodeExtensionValue(r.extension, key);
var requestedValue = (0, UnicodeExtensionValue_1.UnicodeExtensionValue)(r.extension, key);
if (requestedValue !== void 0) {

@@ -253,7 +250,7 @@ if (requestedValue !== "") {

value = requestedValue;
supportedExtensionAddition = "-" + key + "-" + value;
supportedExtensionAddition = "-".concat(key, "-").concat(value);
}
} else if (~requestedValue.indexOf("true")) {
value = "true";
supportedExtensionAddition = "-" + key;
supportedExtensionAddition = "-".concat(key);
}

@@ -264,3 +261,3 @@ }

var optionsValue = options[key];
utils_1.invariant(typeof optionsValue === "string" || typeof optionsValue === "undefined" || optionsValue === null, "optionsValue must be String, Undefined or Null");
(0, utils_1.invariant)(typeof optionsValue === "string" || typeof optionsValue === "undefined" || optionsValue === null, "optionsValue must be String, Undefined or Null");
if (~keyLocaleData.indexOf(optionsValue)) {

@@ -307,3 +304,3 @@ if (optionsValue !== value) {

var noExtensionLocale = locale.replace(utils_1.UNICODE_EXTENSION_SEQUENCE_REGEX, "");
var availableLocale = BestAvailableLocale_1.BestAvailableLocale(availableLocales, noExtensionLocale);
var availableLocale = (0, BestAvailableLocale_1.BestAvailableLocale)(availableLocales, noExtensionLocale);
if (availableLocale) {

@@ -331,3 +328,3 @@ subset.push(availableLocale);

}, new Set());
return ResolveLocale_1.ResolveLocale(locales, requestedLocales, {
return (0, ResolveLocale_1.ResolveLocale)(locales, requestedLocales, {
localeMatcher: (opts === null || opts === void 0 ? void 0 : opts.algorithm) || "best fit"

@@ -426,3 +423,3 @@ }, [], {}, function() {

}).length) {
throw new RangeError(value + " is not within " + values.join(", "));
throw new RangeError("".concat(value, " is not within ").concat(values.join(", ")));
}

@@ -514,3 +511,3 @@ return value;

if (!slots) {
throw new TypeError(pl + " InternalSlot has not been initialized");
throw new TypeError("".concat(pl, " InternalSlot has not been initialized"));
}

@@ -538,4 +535,4 @@ return fields.reduce(function(all, f) {

// bazel-out/darwin-fastbuild/bin/packages/ecma402-abstract/lib/NumberFormat/format_to_parts.js
var CARET_S_UNICODE_REGEX = new RegExp("^" + S_UNICODE_REGEX.source);
var S_DOLLAR_UNICODE_REGEX = new RegExp(S_UNICODE_REGEX.source + "$");
var CARET_S_UNICODE_REGEX = new RegExp("^".concat(S_UNICODE_REGEX.source));
var S_DOLLAR_UNICODE_REGEX = new RegExp("".concat(S_UNICODE_REGEX.source, "$"));

@@ -554,3 +551,3 @@ // bazel-out/darwin-fastbuild/bin/packages/ecma402-abstract/lib/NumberFormat/InitializeNumberFormat.js

endIndex = pattern.indexOf("}", beginIndex);
invariant(endIndex > beginIndex, "Invalid pattern " + pattern);
invariant(endIndex > beginIndex, "Invalid pattern ".concat(pattern));
if (beginIndex > nextIndex) {

@@ -615,3 +612,3 @@ result.push({

if (!(instance instanceof ListFormat)) {
throw new TypeError("Method Intl.ListFormat.prototype." + method + " called on incompatible receiver " + String(instance));
throw new TypeError("Method Intl.ListFormat.prototype.".concat(method, " called on incompatible receiver ").concat(String(instance)));
}

@@ -627,3 +624,3 @@ }

if (typeof el !== "string") {
throw new TypeError("array list[" + list.indexOf(el) + "] is not type String");
throw new TypeError("array list[".concat(list.indexOf(el), "] is not type String"));
}

@@ -678,3 +675,3 @@ result.push(el);

} else {
invariant(part in placeables, part + " is missing from placables");
invariant(part in placeables, "".concat(part, " is missing from placables"));
var subst = placeables[part];

@@ -711,3 +708,3 @@ if (Array.isArray(subst)) {

var dataLocaleData = localeData[dataLocale];
invariant(!!dataLocaleData, "Missing locale data for " + dataLocale);
invariant(!!dataLocaleData, "Missing locale data for ".concat(dataLocale));
var dataLocaleTypes = dataLocaleData[type];

@@ -714,0 +711,0 @@ var templates = dataLocaleTypes[style];

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var _1 = tslib_1.__importDefault(require("./"));
var _1 = (0, tslib_1.__importDefault)(require("./"));
var should_polyfill_1 = require("./should-polyfill");
if (should_polyfill_1.shouldPolyfill()) {
if ((0, should_polyfill_1.shouldPolyfill)()) {
Object.defineProperty(Intl, 'ListFormat', {

@@ -8,0 +8,0 @@ value: _1.default,

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc