Socket
Socket
Sign inDemoInstall

@formatjs/intl-listformat

Package Overview
Dependencies
Maintainers
2
Versions
140
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@formatjs/intl-listformat - npm Package Compare versions

Comparing version 1.2.2 to 1.2.3

LICENSE.md

8

CHANGELOG.md

@@ -6,2 +6,10 @@ # Change Log

## [1.2.3](https://github.com/formatjs/formatjs/compare/@formatjs/intl-listformat@1.2.2...@formatjs/intl-listformat@1.2.3) (2019-11-20)
**Note:** Version bump only for package @formatjs/intl-listformat
## [1.2.2](https://github.com/formatjs/formatjs/compare/@formatjs/intl-listformat@1.2.1...@formatjs/intl-listformat@1.2.2) (2019-11-10)

@@ -8,0 +16,0 @@

154

dist/umd/intl-listformat.js

@@ -8,2 +8,55 @@ (function (global, factory) {

/**
* https://tc39.es/ecma262/#sec-toobject
* @param arg
*/
function toObject(arg) {
if (arg == null) {
throw new TypeError('undefined/null cannot be converted to object');
}
return Object(arg);
}
/**
* https://tc39.es/ecma402/#sec-getoption
* @param opts
* @param prop
* @param type
* @param values
* @param fallback
*/
function getOption(opts, prop, type, values, fallback) {
// const descriptor = Object.getOwnPropertyDescriptor(opts, prop);
var value = opts[prop];
if (value !== undefined) {
if (type !== 'boolean' && type !== 'string') {
throw new TypeError('invalid type');
}
if (type === 'boolean') {
value = Boolean(value);
}
if (type === 'string') {
value = String(value);
}
if (values !== undefined && !values.filter(function (val) { return val == value; }).length) {
throw new RangeError(value + " in not within " + values);
}
return value;
}
return fallback;
}
function setInternalSlot(map, pl, field, value) {
if (!map.get(pl)) {
map.set(pl, Object.create(null));
}
var slots = map.get(pl);
slots[field] = value;
}
function getInternalSlot(map, pl, field) {
var slots = map.get(pl);
if (!slots) {
throw new TypeError('PluralRules has not been initialized');
}
return slots[field];
}
/**
* IE11-safe version of getCanonicalLocales since it's ES2016

@@ -28,2 +81,26 @@ * @param locales locales

var __extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __assign = (undefined && undefined.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
function createResolveLocale(getDefaultLocale) {

@@ -249,65 +326,2 @@ var lookupMatcher = createLookupMatcher(getDefaultLocale);

}
var __extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __assign = (undefined && undefined.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
/**
* https://tc39.es/ecma262/#sec-toobject
* @param arg
*/
function toObject(arg) {
if (arg == null) {
throw new TypeError('undefined/null cannot be converted to object');
}
return Object(arg);
}
/**
* https://tc39.es/ecma402/#sec-getoption
* @param opts
* @param prop
* @param type
* @param values
* @param fallback
*/
function getOption(opts, prop, type, values, fallback) {
// const descriptor = Object.getOwnPropertyDescriptor(opts, prop);
var value = opts[prop];
if (value !== undefined) {
if (type !== 'boolean' && type !== 'string') {
throw new TypeError('invalid type');
}
if (type === 'boolean') {
value = Boolean(value);
}
if (type === 'string') {
value = String(value);
}
if (values !== undefined && !values.filter(function (val) { return val == value; }).length) {
throw new RangeError(value + " in not within " + values);
}
return value;
}
return fallback;
}
var MissingLocaleDataError = /** @class */ (function (_super) {

@@ -333,16 +347,2 @@ __extends(MissingLocaleDataError, _super);

}
function setInternalSlot(map, pl, field, value) {
if (!map.get(pl)) {
map.set(pl, Object.create(null));
}
var slots = map.get(pl);
slots[field] = value;
}
function getInternalSlot(map, pl, field) {
var slots = map.get(pl);
if (!slots) {
throw new TypeError('PluralRules has not been initialized');
}
return slots[field];
}

@@ -349,0 +349,0 @@ var __assign$1 = (undefined && undefined.__assign) || function () {

@@ -1,2 +0,2 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).IntlRelativeTimeFormat={})}(this,function(e){"use strict";function O(e){var t=Intl.getCanonicalLocales;return"function"==typeof t?t(e):Intl.NumberFormat.supportedLocalesOf(e||"")}function m(e,t,r){if(void 0===r&&(r=Error),!e)throw new r(t)}function s(e){var b=function(u){return function(e,t){for(var r={locale:""},n=0,a=t;n<a.length;n++){var o=a[n],l=o.replace(c,""),i=f(e,l);if(i)return r.locale=i,o!==l&&(r.extension=o.slice(l.length+1,o.length)),r}return r.locale=u(),r}}(e),L=function(u){return function(e,t){for(var r={locale:""},n=0,a=t;n<a.length;n++){var o=a[n],l=o.replace(c,""),i=f(e,l);if(i)return r.locale=i,o!==l&&(r.extension=o.slice(l.length+1,o.length)),r}return r.locale=u(),r}}(e);return function(e,t,r,n,a){for(var o,l=(o="lookup"===r.localeMatcher?b(e,t):L(e,t)).locale,i={locale:"",dataLocale:l},u="-u",c=0,f=n;c<f.length;c++){var s=f[c],p=a[l];m("object"==typeof p&&null!==p,"locale data "+s+" must be an object");var _=p[s];m(Array.isArray(_),"keyLocaleData must be an array");var v=_[0];m("string"==typeof v||null===v,"value must be string or null");var h="";if(o.extension){var y=A(o.extension,s);void 0!==y&&(""!==y?~_.indexOf(y)&&(h="-"+s+"-"+(v=y)):~y.indexOf("true")&&(v="true",h="-"+s))}if(s in r){var d=r[s];m("string"==typeof d||null==d,"optionsValue must be String, Undefined or Null"),~_.indexOf(d)&&d!==v&&(v=d,h="")}i[s]=v,u+=h}if(2<u.length){var g=l.indexOf("-x-");if(-1===g)l+=u;else l=l.slice(0,g)+u+l.slice(g,l.length);l=O(l)[0]}return i.locale=l,i}}function A(e,t){m(2===t.length,"key must have 2 elements");var r=e.length,n="-"+t+"-",a=e.indexOf(n);if(-1!==a){for(var o=a+4,l=o,i=o,u=!1;!u;){var c=e.indexOf("-",i);2===(-1===c?r-i:c-i)?u=!0:-1===c?(l=r,u=!0):i=(l=c)+1}return e.slice(o,l)}if(n="-"+t,-1!==(a=e.indexOf(n))&&a+3===r)return""}var c=/-u(?:-[0-9a-z]{2,8})+/gi;function f(e,t){for(var r=t;;){if(~e.indexOf(r))return r;var n=r.lastIndexOf("-");if(!~n)return;2<=n&&"-"===r[n-2]&&(n-=2),r=r.slice(0,n)}}function n(e,t){for(var r=[],n=0,a=t;n<a.length;n++){var o=f(e,a[n].replace(c,""));o&&r.push(o)}return r}var a,t=(a=function(e,t){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}a(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),o=function(){return(o=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e}).apply(this,arguments)};function p(e){if(null==e)throw new TypeError("undefined/null cannot be converted to object");return Object(e)}function _(e,t,r,n,a){var o=e[t];if(void 0===o)return a;if("boolean"!==r&&"string"!==r)throw new TypeError("invalid type");if("boolean"===r&&(o=Boolean(o)),"string"===r&&(o=String(o)),void 0!==n&&!n.filter(function(e){return e==o}).length)throw new RangeError(o+" in not within "+n);return o}var r,l=(r=Error,t(i,r),i);function i(){var e=null!==r&&r.apply(this,arguments)||this;return e.type="MISSING_LOCALE_DATA",e}function v(e,t,r,n){e.get(t)||e.set(t,Object.create(null)),e.get(t)[r]=n}function u(e,t,r){var n=e.get(t);if(!n)throw new TypeError("PluralRules has not been initialized");return n[r]}var h=function(){return(h=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e}).apply(this,arguments)},y=function(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;var n=Array(e),a=0;for(t=0;t<r;t++)for(var o=arguments[t],l=0,i=o.length;l<i;l++,a++)n[a]=o[l];return n};function d(e,t){if(!(e instanceof T))throw new TypeError("Method Intl.ListFormat.prototype."+t+" called on incompatible receiver "+String(e))}function g(e){if(void 0===e)return[];for(var t=[],r=0,n=e;r<n.length;r++){var a=n[r];if("string"!=typeof a)throw new TypeError("array list["+e.indexOf(a)+"] is not type String");t.push(a)}return t}function b(e,t,r){var n=r.length;if(0===n)return[];if(2===n)return L(u(e,t,"templatePair"),{0:{type:"element",value:r[0]},1:{type:"element",value:r[1]}});for(var a={type:"element",value:r[n-1]},o=n-2;0<=o;){a=L(u(e,t,0===o?"templateStart":o<n-2?"templateMiddle":"templateEnd"),{0:{type:"element",value:r[o]},1:a}),o--}return a}function L(e,t){for(var r=[],n=e.indexOf("{",0),a=0;-1<n&&n<e.length;){var o=e.indexOf("}",n);if(o<=n)throw new Error("endIndex "+o+" should be bigger than beginIndex "+n);a<n&&r.push({type:"literal",value:e.slice(a,n)});var l=e.slice(n+1,o);if(!(l in t))throw new Error("Missing key "+l+" from placeables");var i=t[l];if(Array.isArray(i))for(var u=0,c=i;u<c.length;u++){var f=c[u];r.push(f)}else r.push(i);a=o+1,n=e.indexOf("{",a)}if(a<e.length){var s=e.slice(a,e.length);r.push({type:"literal",value:s})}return r}var T=(w.prototype.format=function(e){d(this,"format");var t="",r=b(w.__INTERNAL_SLOT_MAP__,this,g(e));if(!Array.isArray(r))return r.value;for(var n=0,a=r;n<a.length;n++)t+=a[n].value;return t},w.prototype.formatToParts=function(e){d(this,"format");var t=b(w.__INTERNAL_SLOT_MAP__,this,g(e));if(!Array.isArray(t))return[t];for(var r=[],n=0,a=t;n<a.length;n++){var o=a[n];r.push(h({},o))}return r},w.prototype.resolvedOptions=function(){return d(this,"resolvedOptions"),{locale:u(w.__INTERNAL_SLOT_MAP__,this,"locale"),type:u(w.__INTERNAL_SLOT_MAP__,this,"type"),style:u(w.__INTERNAL_SLOT_MAP__,this,"style")}},w.supportedLocalesOf=function(e,t){return function(e,t,r){return void 0!==r&&_(r=p(r),"localeMatcher","string",["lookup","best fit"],"best fit"),n(e,t)}(w.availableLocales,O(e),t)},w.__addLocaleData=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var r=function(t){Object.keys(y(t.availableLocales,Object.keys(t.aliases),Object.keys(t.parentLocales)).reduce(function(e,t){return e[t]=!0,e},{})).forEach(function(e){try{w.localeData[e]=function(e,t){var r=function(e,t,r){var n=[e];t[e]&&(e=t[e],n.push(e));var a=r[e];a&&n.push(a);for(var o=e.split("-"),l=o.length;1<l;l--)n.push(o.slice(0,l-1).join("-"));return n}(e,t.aliases,t.parentLocales),n=r.map(function(e){return t.data[e]}).filter(Boolean);if(!n.length)throw new l('Missing locale data for "'+e+'", lookup hierarchy: '+r.join(", "));return n.reverse(),n.reduce(function(e,t){return o(o({},e),t)},{})}(e,t)}catch(e){}})},n=0,a=e;n<a.length;n++)r(a[n]);w.availableLocales=Object.keys(w.localeData),w.__defaultLocale||(w.__defaultLocale=w.availableLocales[0])},w.getDefaultLocale=function(){return w.__defaultLocale},w.localeData={},w.availableLocales=[],w.__defaultLocale="en",w.relevantExtensionKeys=[],w.polyfilled=!0,w.__INTERNAL_SLOT_MAP__=new WeakMap,w);function w(e,t){if(!(this&&this instanceof w?this.constructor:void 0))throw new TypeError("Intl.ListFormat must be called with 'new'");v(w.__INTERNAL_SLOT_MAP__,this,"initializedListFormat",!0);var r=O(e),n=Object.create(null),a=void 0===t?Object.create(null):p(t),o=_(a,"localeMatcher","string",["best fit","lookup"],"best fit");n.localeMatcher=o;var l=w.localeData,i=s(w.getDefaultLocale)(w.availableLocales,r,n,w.relevantExtensionKeys,l);v(w.__INTERNAL_SLOT_MAP__,this,"locale",i.locale);var u=_(a,"type","string",["conjunction","disjunction","unit"],"conjunction");v(w.__INTERNAL_SLOT_MAP__,this,"type",u);var c=_(a,"style","string",["long","short","narrow"],"long");v(w.__INTERNAL_SLOT_MAP__,this,"style",c);var f=l[i.dataLocale][u][c];v(w.__INTERNAL_SLOT_MAP__,this,"templatePair",f.pair),v(w.__INTERNAL_SLOT_MAP__,this,"templateStart",f.start),v(w.__INTERNAL_SLOT_MAP__,this,"templateMiddle",f.middle),v(w.__INTERNAL_SLOT_MAP__,this,"templateEnd",f.end)}try{"undefined"!=typeof Symbol&&Object.defineProperty(T.prototype,Symbol.toStringTag,{value:"Intl.ListFormat",writable:!1,enumerable:!1,configurable:!0}),Object.defineProperty(T.prototype.constructor,"length",{value:0,writable:!1,enumerable:!1,configurable:!0}),Object.defineProperty(T.supportedLocalesOf,"length",{value:1,writable:!1,enumerable:!1,configurable:!0})}catch(e){}e.default=T,Object.defineProperty(e,"__esModule",{value:!0})});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).IntlRelativeTimeFormat={})}(this,function(e){"use strict";function s(e){if(null==e)throw new TypeError("undefined/null cannot be converted to object");return Object(e)}function p(e,t,r,n,a){var o=e[t];if(void 0===o)return a;if("boolean"!==r&&"string"!==r)throw new TypeError("invalid type");if("boolean"===r&&(o=Boolean(o)),"string"===r&&(o=String(o)),void 0!==n&&!n.filter(function(e){return e==o}).length)throw new RangeError(o+" in not within "+n);return o}function _(e,t,r,n){e.get(t)||e.set(t,Object.create(null)),e.get(t)[r]=n}function l(e,t,r){var n=e.get(t);if(!n)throw new TypeError("PluralRules has not been initialized");return n[r]}function O(e){var t=Intl.getCanonicalLocales;return"function"==typeof t?t(e):Intl.NumberFormat.supportedLocalesOf(e||"")}function m(e,t,r){if(void 0===r&&(r=Error),!e)throw new r(t)}var n,t=(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),o=function(){return(o=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e}).apply(this,arguments)};function v(e){var b=function(u){return function(e,t){for(var r={locale:""},n=0,a=t;n<a.length;n++){var o=a[n],l=o.replace(c,""),i=f(e,l);if(i)return r.locale=i,o!==l&&(r.extension=o.slice(l.length+1,o.length)),r}return r.locale=u(),r}}(e),L=function(u){return function(e,t){for(var r={locale:""},n=0,a=t;n<a.length;n++){var o=a[n],l=o.replace(c,""),i=f(e,l);if(i)return r.locale=i,o!==l&&(r.extension=o.slice(l.length+1,o.length)),r}return r.locale=u(),r}}(e);return function(e,t,r,n,a){for(var o,l=(o="lookup"===r.localeMatcher?b(e,t):L(e,t)).locale,i={locale:"",dataLocale:l},u="-u",c=0,f=n;c<f.length;c++){var s=f[c],p=a[l];m("object"==typeof p&&null!==p,"locale data "+s+" must be an object");var _=p[s];m(Array.isArray(_),"keyLocaleData must be an array");var v=_[0];m("string"==typeof v||null===v,"value must be string or null");var h="";if(o.extension){var y=A(o.extension,s);void 0!==y&&(""!==y?~_.indexOf(y)&&(h="-"+s+"-"+(v=y)):~y.indexOf("true")&&(v="true",h="-"+s))}if(s in r){var d=r[s];m("string"==typeof d||null==d,"optionsValue must be String, Undefined or Null"),~_.indexOf(d)&&d!==v&&(v=d,h="")}i[s]=v,u+=h}if(2<u.length){var g=l.indexOf("-x-");if(-1===g)l+=u;else l=l.slice(0,g)+u+l.slice(g,l.length);l=O(l)[0]}return i.locale=l,i}}function A(e,t){m(2===t.length,"key must have 2 elements");var r=e.length,n="-"+t+"-",a=e.indexOf(n);if(-1!==a){for(var o=a+4,l=o,i=o,u=!1;!u;){var c=e.indexOf("-",i);2===(-1===c?r-i:c-i)?u=!0:-1===c?(l=r,u=!0):i=(l=c)+1}return e.slice(o,l)}if(n="-"+t,-1!==(a=e.indexOf(n))&&a+3===r)return""}var c=/-u(?:-[0-9a-z]{2,8})+/gi;function f(e,t){for(var r=t;;){if(~e.indexOf(r))return r;var n=r.lastIndexOf("-");if(!~n)return;2<=n&&"-"===r[n-2]&&(n-=2),r=r.slice(0,n)}}function a(e,t){for(var r=[],n=0,a=t;n<a.length;n++){var o=f(e,a[n].replace(c,""));o&&r.push(o)}return r}var r,i=(r=Error,t(u,r),u);function u(){var e=null!==r&&r.apply(this,arguments)||this;return e.type="MISSING_LOCALE_DATA",e}var h=function(){return(h=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e}).apply(this,arguments)},y=function(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;var n=Array(e),a=0;for(t=0;t<r;t++)for(var o=arguments[t],l=0,i=o.length;l<i;l++,a++)n[a]=o[l];return n};function d(e,t){if(!(e instanceof T))throw new TypeError("Method Intl.ListFormat.prototype."+t+" called on incompatible receiver "+String(e))}function g(e){if(void 0===e)return[];for(var t=[],r=0,n=e;r<n.length;r++){var a=n[r];if("string"!=typeof a)throw new TypeError("array list["+e.indexOf(a)+"] is not type String");t.push(a)}return t}function b(e,t,r){var n=r.length;if(0===n)return[];if(2===n)return L(l(e,t,"templatePair"),{0:{type:"element",value:r[0]},1:{type:"element",value:r[1]}});for(var a={type:"element",value:r[n-1]},o=n-2;0<=o;){a=L(l(e,t,0===o?"templateStart":o<n-2?"templateMiddle":"templateEnd"),{0:{type:"element",value:r[o]},1:a}),o--}return a}function L(e,t){for(var r=[],n=e.indexOf("{",0),a=0;-1<n&&n<e.length;){var o=e.indexOf("}",n);if(o<=n)throw new Error("endIndex "+o+" should be bigger than beginIndex "+n);a<n&&r.push({type:"literal",value:e.slice(a,n)});var l=e.slice(n+1,o);if(!(l in t))throw new Error("Missing key "+l+" from placeables");var i=t[l];if(Array.isArray(i))for(var u=0,c=i;u<c.length;u++){var f=c[u];r.push(f)}else r.push(i);a=o+1,n=e.indexOf("{",a)}if(a<e.length){var s=e.slice(a,e.length);r.push({type:"literal",value:s})}return r}var T=(w.prototype.format=function(e){d(this,"format");var t="",r=b(w.__INTERNAL_SLOT_MAP__,this,g(e));if(!Array.isArray(r))return r.value;for(var n=0,a=r;n<a.length;n++)t+=a[n].value;return t},w.prototype.formatToParts=function(e){d(this,"format");var t=b(w.__INTERNAL_SLOT_MAP__,this,g(e));if(!Array.isArray(t))return[t];for(var r=[],n=0,a=t;n<a.length;n++){var o=a[n];r.push(h({},o))}return r},w.prototype.resolvedOptions=function(){return d(this,"resolvedOptions"),{locale:l(w.__INTERNAL_SLOT_MAP__,this,"locale"),type:l(w.__INTERNAL_SLOT_MAP__,this,"type"),style:l(w.__INTERNAL_SLOT_MAP__,this,"style")}},w.supportedLocalesOf=function(e,t){return function(e,t,r){return void 0!==r&&p(r=s(r),"localeMatcher","string",["lookup","best fit"],"best fit"),a(e,t)}(w.availableLocales,O(e),t)},w.__addLocaleData=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var r=function(t){Object.keys(y(t.availableLocales,Object.keys(t.aliases),Object.keys(t.parentLocales)).reduce(function(e,t){return e[t]=!0,e},{})).forEach(function(e){try{w.localeData[e]=function(e,t){var r=function(e,t,r){var n=[e];t[e]&&(e=t[e],n.push(e));var a=r[e];a&&n.push(a);for(var o=e.split("-"),l=o.length;1<l;l--)n.push(o.slice(0,l-1).join("-"));return n}(e,t.aliases,t.parentLocales),n=r.map(function(e){return t.data[e]}).filter(Boolean);if(!n.length)throw new i('Missing locale data for "'+e+'", lookup hierarchy: '+r.join(", "));return n.reverse(),n.reduce(function(e,t){return o(o({},e),t)},{})}(e,t)}catch(e){}})},n=0,a=e;n<a.length;n++)r(a[n]);w.availableLocales=Object.keys(w.localeData),w.__defaultLocale||(w.__defaultLocale=w.availableLocales[0])},w.getDefaultLocale=function(){return w.__defaultLocale},w.localeData={},w.availableLocales=[],w.__defaultLocale="en",w.relevantExtensionKeys=[],w.polyfilled=!0,w.__INTERNAL_SLOT_MAP__=new WeakMap,w);function w(e,t){if(!(this&&this instanceof w?this.constructor:void 0))throw new TypeError("Intl.ListFormat must be called with 'new'");_(w.__INTERNAL_SLOT_MAP__,this,"initializedListFormat",!0);var r=O(e),n=Object.create(null),a=void 0===t?Object.create(null):s(t),o=p(a,"localeMatcher","string",["best fit","lookup"],"best fit");n.localeMatcher=o;var l=w.localeData,i=v(w.getDefaultLocale)(w.availableLocales,r,n,w.relevantExtensionKeys,l);_(w.__INTERNAL_SLOT_MAP__,this,"locale",i.locale);var u=p(a,"type","string",["conjunction","disjunction","unit"],"conjunction");_(w.__INTERNAL_SLOT_MAP__,this,"type",u);var c=p(a,"style","string",["long","short","narrow"],"long");_(w.__INTERNAL_SLOT_MAP__,this,"style",c);var f=l[i.dataLocale][u][c];_(w.__INTERNAL_SLOT_MAP__,this,"templatePair",f.pair),_(w.__INTERNAL_SLOT_MAP__,this,"templateStart",f.start),_(w.__INTERNAL_SLOT_MAP__,this,"templateMiddle",f.middle),_(w.__INTERNAL_SLOT_MAP__,this,"templateEnd",f.end)}try{"undefined"!=typeof Symbol&&Object.defineProperty(T.prototype,Symbol.toStringTag,{value:"Intl.ListFormat",writable:!1,enumerable:!1,configurable:!0}),Object.defineProperty(T.prototype.constructor,"length",{value:0,writable:!1,enumerable:!1,configurable:!0}),Object.defineProperty(T.supportedLocalesOf,"length",{value:1,writable:!1,enumerable:!1,configurable:!0})}catch(e){}e.default=T,Object.defineProperty(e,"__esModule",{value:!0})});
//# sourceMappingURL=intl-listformat.min.js.map

@@ -7,2 +7,55 @@ (function (factory) {

/**
* https://tc39.es/ecma262/#sec-toobject
* @param arg
*/
function toObject(arg) {
if (arg == null) {
throw new TypeError('undefined/null cannot be converted to object');
}
return Object(arg);
}
/**
* https://tc39.es/ecma402/#sec-getoption
* @param opts
* @param prop
* @param type
* @param values
* @param fallback
*/
function getOption(opts, prop, type, values, fallback) {
// const descriptor = Object.getOwnPropertyDescriptor(opts, prop);
var value = opts[prop];
if (value !== undefined) {
if (type !== 'boolean' && type !== 'string') {
throw new TypeError('invalid type');
}
if (type === 'boolean') {
value = Boolean(value);
}
if (type === 'string') {
value = String(value);
}
if (values !== undefined && !values.filter(function (val) { return val == value; }).length) {
throw new RangeError(value + " in not within " + values);
}
return value;
}
return fallback;
}
function setInternalSlot(map, pl, field, value) {
if (!map.get(pl)) {
map.set(pl, Object.create(null));
}
var slots = map.get(pl);
slots[field] = value;
}
function getInternalSlot(map, pl, field) {
var slots = map.get(pl);
if (!slots) {
throw new TypeError('PluralRules has not been initialized');
}
return slots[field];
}
/**
* IE11-safe version of getCanonicalLocales since it's ES2016

@@ -27,2 +80,26 @@ * @param locales locales

var __extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __assign = (undefined && undefined.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
function createResolveLocale(getDefaultLocale) {

@@ -248,65 +325,2 @@ var lookupMatcher = createLookupMatcher(getDefaultLocale);

}
var __extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __assign = (undefined && undefined.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
/**
* https://tc39.es/ecma262/#sec-toobject
* @param arg
*/
function toObject(arg) {
if (arg == null) {
throw new TypeError('undefined/null cannot be converted to object');
}
return Object(arg);
}
/**
* https://tc39.es/ecma402/#sec-getoption
* @param opts
* @param prop
* @param type
* @param values
* @param fallback
*/
function getOption(opts, prop, type, values, fallback) {
// const descriptor = Object.getOwnPropertyDescriptor(opts, prop);
var value = opts[prop];
if (value !== undefined) {
if (type !== 'boolean' && type !== 'string') {
throw new TypeError('invalid type');
}
if (type === 'boolean') {
value = Boolean(value);
}
if (type === 'string') {
value = String(value);
}
if (values !== undefined && !values.filter(function (val) { return val == value; }).length) {
throw new RangeError(value + " in not within " + values);
}
return value;
}
return fallback;
}
var MissingLocaleDataError = /** @class */ (function (_super) {

@@ -332,16 +346,2 @@ __extends(MissingLocaleDataError, _super);

}
function setInternalSlot(map, pl, field, value) {
if (!map.get(pl)) {
map.set(pl, Object.create(null));
}
var slots = map.get(pl);
slots[field] = value;
}
function getInternalSlot(map, pl, field) {
var slots = map.get(pl);
if (!slots) {
throw new TypeError('PluralRules has not been initialized');
}
return slots[field];
}

@@ -348,0 +348,0 @@ var __assign$1 = (undefined && undefined.__assign) || function () {

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

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

"devDependencies": {
"formatjs-extract-cldr-data": "^9.9.2"
"formatjs-extract-cldr-data": "^9.9.3"
},
"dependencies": {
"@formatjs/intl-utils": "^1.4.0"
"@formatjs/intl-utils": "^1.4.1"
},

@@ -40,3 +40,3 @@ "main": "dist/index.js",

"license": "MIT",
"gitHead": "64f3cbd32a69c2d2dc0a67384fb935dc48fc890b"
"gitHead": "ec6c8fef94f11be9f0435427309d9d284823ec6a"
}

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

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

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