Socket
Socket
Sign inDemoInstall

@formatjs/intl-listformat

Package Overview
Dependencies
Maintainers
3
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.4.8 to 2.0.0

17

CHANGELOG.md

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

# [2.0.0](https://github.com/formatjs/formatjs/compare/@formatjs/intl-listformat@1.4.8...@formatjs/intl-listformat@2.0.0) (2020-05-23)
### Features
* **@formatjs/intl-listformat:** Use native Intl.getCanonicalLocales ([ea78382](https://github.com/formatjs/formatjs/commit/ea783828b86b2744a89f0b2b616ebe535f32f3df))
### BREAKING CHANGES
* **@formatjs/intl-listformat:** This requires @formatjs/intl-getcanonicallocales for
IE11 and below
## [1.4.8](https://github.com/formatjs/formatjs/compare/@formatjs/intl-listformat@1.4.7...@formatjs/intl-listformat@1.4.8) (2020-05-16)

@@ -8,0 +25,0 @@

7

dist-es6/core.js

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

import { toObject, getOption, unpackData, setInternalSlot, getCanonicalLocales, supportedLocales, createResolveLocale, getInternalSlot, partitionPattern, invariant, isLiteralPart, } from '@formatjs/intl-utils';
import { toObject, getOption, unpackData, setInternalSlot, supportedLocales, createResolveLocale, getInternalSlot, partitionPattern, invariant, isLiteralPart, } from '@formatjs/intl-utils';
function validateInstance(instance, method) {

@@ -91,3 +91,4 @@ if (!(instance instanceof ListFormat)) {

setInternalSlot(ListFormat.__INTERNAL_SLOT_MAP__, this, 'initializedListFormat', true);
const requestedLocales = getCanonicalLocales(locales);
const requestedLocales = Intl
.getCanonicalLocales(locales);
const opt = Object.create(null);

@@ -147,3 +148,3 @@ const opts = options === undefined ? Object.create(null) : toObject(options);

// test262/test/intl402/ListFormat/constructor/supportedLocalesOf/result-type.js
return supportedLocales(ListFormat.availableLocales, getCanonicalLocales(locales), options);
return supportedLocales(ListFormat.availableLocales, Intl.getCanonicalLocales(locales), options);
}

@@ -150,0 +151,0 @@ static __addLocaleData(...data) {

@@ -113,3 +113,4 @@ "use strict";

intl_utils_1.setInternalSlot(ListFormat.__INTERNAL_SLOT_MAP__, this, 'initializedListFormat', true);
var requestedLocales = intl_utils_1.getCanonicalLocales(locales);
var requestedLocales = Intl
.getCanonicalLocales(locales);
var opt = Object.create(null);

@@ -171,3 +172,3 @@ var opts = options === undefined ? Object.create(null) : intl_utils_1.toObject(options);

// test262/test/intl402/ListFormat/constructor/supportedLocalesOf/result-type.js
return intl_utils_1.supportedLocales(ListFormat.availableLocales, intl_utils_1.getCanonicalLocales(locales), options);
return intl_utils_1.supportedLocales(ListFormat.availableLocales, Intl.getCanonicalLocales(locales), options);
};

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

@@ -120,19 +120,2 @@ (function (global, factory) {

/**
* IE11-safe version of getCanonicalLocales since it's ES2016
* @param locales locales
*/
function getCanonicalLocales(locales) {
// IE11
var getCanonicalLocales = Intl.getCanonicalLocales;
if (typeof getCanonicalLocales === 'function') {
return getCanonicalLocales(locales);
}
// NOTE: we must NOT call `supportedLocalesOf` of a formatjs polyfill, or their implementation
// will even eventually call this method recursively. Here we use `Intl.DateTimeFormat` since it
// is not polyfilled by `@formatjs`.
// TODO: Fix TypeScript type def for this bc undefined is just fine
return Intl.DateTimeFormat.supportedLocalesOf(locales);
}
var __extends = (undefined && undefined.__extends) || (function () {

@@ -229,3 +212,3 @@ var extendStatics = function (d, b) {

}
foundLocale = getCanonicalLocales(foundLocale)[0];
foundLocale = Intl.getCanonicalLocales(foundLocale)[0];
}

@@ -516,3 +499,4 @@ result.locale = foundLocale;

setInternalSlot(ListFormat.__INTERNAL_SLOT_MAP__, this, 'initializedListFormat', true);
var requestedLocales = getCanonicalLocales(locales);
var requestedLocales = Intl
.getCanonicalLocales(locales);
var opt = Object.create(null);

@@ -574,3 +558,3 @@ var opts = options === undefined ? Object.create(null) : toObject(options);

// test262/test/intl402/ListFormat/constructor/supportedLocalesOf/result-type.js
return supportedLocales(ListFormat.availableLocales, getCanonicalLocales(locales), options);
return supportedLocales(ListFormat.availableLocales, Intl.getCanonicalLocales(locales), options);
};

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

@@ -119,19 +119,2 @@ (function (factory) {

/**
* IE11-safe version of getCanonicalLocales since it's ES2016
* @param locales locales
*/
function getCanonicalLocales(locales) {
// IE11
var getCanonicalLocales = Intl.getCanonicalLocales;
if (typeof getCanonicalLocales === 'function') {
return getCanonicalLocales(locales);
}
// NOTE: we must NOT call `supportedLocalesOf` of a formatjs polyfill, or their implementation
// will even eventually call this method recursively. Here we use `Intl.DateTimeFormat` since it
// is not polyfilled by `@formatjs`.
// TODO: Fix TypeScript type def for this bc undefined is just fine
return Intl.DateTimeFormat.supportedLocalesOf(locales);
}
var __extends = (undefined && undefined.__extends) || (function () {

@@ -228,3 +211,3 @@ var extendStatics = function (d, b) {

}
foundLocale = getCanonicalLocales(foundLocale)[0];
foundLocale = Intl.getCanonicalLocales(foundLocale)[0];
}

@@ -515,3 +498,4 @@ result.locale = foundLocale;

setInternalSlot(ListFormat.__INTERNAL_SLOT_MAP__, this, 'initializedListFormat', true);
var requestedLocales = getCanonicalLocales(locales);
var requestedLocales = Intl
.getCanonicalLocales(locales);
var opt = Object.create(null);

@@ -573,3 +557,3 @@ var opts = options === undefined ? Object.create(null) : toObject(options);

// test262/test/intl402/ListFormat/constructor/supportedLocalesOf/result-type.js
return supportedLocales(ListFormat.availableLocales, getCanonicalLocales(locales), options);
return supportedLocales(ListFormat.availableLocales, Intl.getCanonicalLocales(locales), options);
};

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

@@ -19,3 +19,3 @@ var __assign = (this && this.__assign) || function () {

};
import { toObject, getOption, unpackData, setInternalSlot, getCanonicalLocales, supportedLocales, createResolveLocale, getInternalSlot, partitionPattern, invariant, isLiteralPart, } from '@formatjs/intl-utils';
import { toObject, getOption, unpackData, setInternalSlot, supportedLocales, createResolveLocale, getInternalSlot, partitionPattern, invariant, isLiteralPart, } from '@formatjs/intl-utils';
function validateInstance(instance, method) {

@@ -112,3 +112,4 @@ if (!(instance instanceof ListFormat)) {

setInternalSlot(ListFormat.__INTERNAL_SLOT_MAP__, this, 'initializedListFormat', true);
var requestedLocales = getCanonicalLocales(locales);
var requestedLocales = Intl
.getCanonicalLocales(locales);
var opt = Object.create(null);

@@ -170,3 +171,3 @@ var opts = options === undefined ? Object.create(null) : toObject(options);

// test262/test/intl402/ListFormat/constructor/supportedLocalesOf/result-type.js
return supportedLocales(ListFormat.availableLocales, getCanonicalLocales(locales), options);
return supportedLocales(ListFormat.availableLocales, Intl.getCanonicalLocales(locales), options);
};

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

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

@@ -21,4 +21,5 @@ "keywords": [

"devDependencies": {
"@formatjs/intl-getcanonicallocales": "^1.2.0",
"@types/jest": "^25.2.1",
"formatjs-extract-cldr-data": "^10.1.8",
"formatjs-extract-cldr-data": "^10.1.9",
"jest": "^25.4.0",

@@ -28,3 +29,3 @@ "ts-jest": "^25.4.0"

"dependencies": {
"@formatjs/intl-utils": "^2.3.0"
"@formatjs/intl-utils": "^3.0.0"
},

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

"license": "MIT",
"gitHead": "5b218606c3ec03e332f472706fffd04153c20dae"
"gitHead": "a7842673d8ad205171ad7c8cb8bb2f318b427c0c"
}

@@ -7,3 +7,2 @@ import {

setInternalSlot,
getCanonicalLocales,
supportedLocales,

@@ -19,2 +18,3 @@ createResolveLocale,

} from '@formatjs/intl-utils';
import type {getCanonicalLocales} from '@formatjs/intl-getcanonicallocales';

@@ -203,3 +203,4 @@ export interface IntlListFormatOptions {

);
const requestedLocales = getCanonicalLocales(locales);
const requestedLocales = ((Intl as any)
.getCanonicalLocales as typeof getCanonicalLocales)(locales);
const opt: any = Object.create(null);

@@ -319,3 +320,5 @@ const opts =

ListFormat.availableLocales,
getCanonicalLocales(locales),
((Intl as any).getCanonicalLocales as typeof getCanonicalLocales)(
locales
),
options

@@ -322,0 +325,0 @@ );

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 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

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