@formatjs/intl-listformat
Advanced tools
Comparing version 1.4.5 to 1.4.6
@@ -6,2 +6,10 @@ # Change Log | ||
## 1.4.6 (2020-04-28) | ||
**Note:** Version bump only for package @formatjs/intl-listformat | ||
## [1.4.5](https://github.com/formatjs/formatjs/compare/@formatjs/intl-listformat@1.4.4...@formatjs/intl-listformat@1.4.5) (2020-04-24) | ||
@@ -8,0 +16,0 @@ |
@@ -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 v(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 _(e){var b=function(u){return function(e,t){for(var r={locale:""},n=0,o=t;n<o.length;n++){var a=o[n],l=a.replace(c,""),i=f(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}}(e),L=function(u){return function(e,t){for(var r={locale:""},n=0,o=t;n<o.length;n++){var a=o[n],l=a.replace(c,""),i=f(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}}(e);return function(e,t,r,n,o){for(var a,l=(a="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=o[l];O("object"==typeof p&&null!==p,"locale data "+s+" must be an object");var v=p[s];O(Array.isArray(v),"keyLocaleData for "+s+" must be an array");var _=v[0];O("string"==typeof _||null===_,"value must be string or null");var h="";if(a.extension){var y=A(a.extension,s);void 0!==y&&(""!==y?~v.indexOf(y)&&(h="-"+s+"-"+(_=y)):~y.indexOf("true")&&(_="true",h="-"+s))}if(s in r){var d=r[s];O("string"==typeof d||null==d,"optionsValue must be String, Undefined or Null"),~v.indexOf(d)&&d!==_&&(_=d,h="")}i[s]=_,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=m(l)[0]}return i.locale=l,i}}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 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 o(e,t){for(var r=[],n=0,o=t;n<o.length;n++){var a=f(e,o[n].replace(c,""));a&&r.push(a)}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 o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);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),o=0;for(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 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 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 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 o={type:"element",value:r[n-1]},a=n-2;0<=a;){o=L(l(e,t,0===a?"templateStart":a<n-2?"templateMiddle":"templateEnd"),{0:{type:"element",value:r[a]},1:o}),a--}return o}function L(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=o[n],l=a.type;if("literal"===a.type)r.push({type:"literal",value:a.value});else{O(l in t,l+" is missing from placables");var i=t[l];Array.isArray(i)?r.push.apply(r,i):r.push(i)}}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,o=r;n<o.length;n++)t+=o[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,o=t;n<o.length;n++){var a=o[n];r.push(h({},a))}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"),o(e,t)}(w.availableLocales,m(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,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 i('Missing locale data for "'+e+'", lookup hierarchy: '+n.join(", "));return o.reverse(),o.reduce(r,{})}(e,t)}catch(e){}})},n=0,o=e;n<o.length;n++)r(o[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=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=w.localeData,i=_(w.getDefaultLocale)(w.availableLocales,r,n,w.relevantExtensionKeys,l);v(w.__INTERNAL_SLOT_MAP__,this,"locale",i.locale);var u=p(o,"type","string",["conjunction","disjunction","unit"],"conjunction");v(w.__INTERNAL_SLOT_MAP__,this,"type",u);var c=p(o,"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).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,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 v(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]}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)}),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 _(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(f,""),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(f,""),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=(o=("lookup"===r.localeMatcher?b: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];O("object"==typeof p&&null!==p,"locale data "+s+" must be an object");var v=p[s];O(Array.isArray(v),"keyLocaleData for "+s+" must be an array");var _=v[0];O("string"==typeof _||null===_,"value must be string or null");var h="";if(o.extension){var y=A(o.extension,s);void 0!==y&&(""!==y?~v.indexOf(y)&&(h="-"+s+"-"+(_=y)):~y.indexOf("true")&&(_="true",h="-"+s))}if(s in r){var d=r[s];O("string"==typeof d||null==d,"optionsValue must be String, Undefined or Null"),~v.indexOf(d)&&d!==_&&(_=d,h="")}i[s]=_,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=m(l)[0]}return i.locale=l,i}}function A(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 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,a=t;n<a.length;n++){var o=h(e,a[n].replace(f,""));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;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 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 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 T(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=T(l(e,t,0===o?"templateStart":o<n-2?"templateMiddle":"templateEnd"),{0:{type:"element",value:r[o]},1:a}),o--}return a}function T(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=a[n],l=o.type;if("literal"===o.type)r.push({type:"literal",value:o.value});else{O(l in t,l+" is missing from placables");var i=t[l];Array.isArray(i)?r.push.apply(r,i):r.push(i)}}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,a=r;n<a.length;n++)t+=a[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,a=t;n<a.length;n++){var o=a[n];r.push(y({},o))}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!==(a=t)&&p(a=s(a),"localeMatcher","string",["lookup","best fit"],"best fit"),i(r,n);var r,n,a},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,a=e;n<a.length;n++)r(a[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'");v(E.__INTERNAL_SLOT_MAP__,this,"initializedListFormat",!0);var r=m(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=E.localeData,i=_(E.getDefaultLocale)(E.availableLocales,r,n,E.relevantExtensionKeys,l);v(E.__INTERNAL_SLOT_MAP__,this,"locale",i.locale);var u=p(a,"type","string",["conjunction","disjunction","unit"],"conjunction");v(E.__INTERNAL_SLOT_MAP__,this,"type",u);var c=p(a,"style","string",["long","short","narrow"],"long");v(E.__INTERNAL_SLOT_MAP__,this,"style",c);var f=l[i.dataLocale][u][c];v(E.__INTERNAL_SLOT_MAP__,this,"templatePair",f.pair),v(E.__INTERNAL_SLOT_MAP__,this,"templateStart",f.start),v(E.__INTERNAL_SLOT_MAP__,this,"templateMiddle",f.middle),v(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})}); | ||
//# sourceMappingURL=intl-listformat.min.js.map |
{ | ||
"name": "@formatjs/intl-listformat", | ||
"version": "1.4.5", | ||
"version": "1.4.6", | ||
"description": "Formats JS list in a i18n-safe way", | ||
@@ -21,6 +21,9 @@ "keywords": [ | ||
"devDependencies": { | ||
"formatjs-extract-cldr-data": "^10.1.5" | ||
"@types/jest": "^25.2.1", | ||
"formatjs-extract-cldr-data": "^10.1.6", | ||
"jest": "^25.4.0", | ||
"ts-jest": "^25.4.0" | ||
}, | ||
"dependencies": { | ||
"@formatjs/intl-utils": "^2.2.3" | ||
"@formatjs/intl-utils": "^2.2.4" | ||
}, | ||
@@ -39,12 +42,12 @@ "main": "dist/index.js", | ||
"scripts": { | ||
"build": "npm run cldr && npm run compile", | ||
"cldr": "ts-node --project tsconfig.cjs.json scripts/cldr", | ||
"clean": "rimraf dist lib dist-es6 *.tsbuildinfo", | ||
"compile": "tsc && api-extractor run --local && tsc -p tsconfig.cjs.json && tsc -p tsconfig.es6.json && rollup -c rollup.config.js", | ||
"jest": "cross-env NODE_ICU_DATA=../../node_modules/full-icu TS_NODE_PROJECT=tsconfig.cjs.json cross-env NODE_ENV=test jest", | ||
"test": "npm run jest && cross-env NODE_ICU_DATA=../../node_modules/full-icu TS_NODE_PROJECT=tsconfig.cjs.json ts-node tests/runner" | ||
"build": "yarn run cldr && yarn run compile", | ||
"cldr": "ts-node scripts/cldr", | ||
"clean": "rimraf dist lib dist-es6 dist-es6 *.tsbuildinfo", | ||
"compile": "tsc && tsc -p tsconfig.esm.json && tsc -p tsconfig.es6.json && api-extractor run --local && rollup -c rollup.config.js", | ||
"jest": "cross-env NODE_ICU_DATA=../../node_modules/full-icu NODE_ENV=test jest", | ||
"test": "yarn run jest && cross-env NODE_ICU_DATA=../../node_modules/full-icu ts-node tests/runner" | ||
}, | ||
"homepage": "https://github.com/formatjs/formatjs", | ||
"license": "MIT", | ||
"gitHead": "9c83c2c89c3fcf8d68da29be3f1be8f516b21ae0" | ||
"gitHead": "84e7cc6f3723801271661fdbdb5391fac7e6f74c" | ||
} |
@@ -1,1 +0,1 @@ | ||
require('./dist/polyfill') | ||
require('./dist/polyfill'); |
# Intl ListFormat | ||
A spec-compliant polyfill/ponyfill for Intl.ListFormat fully tested by the [official ECMAScript Conformance test suite](https://github.com/tc39/test262) | ||
[![npm Version][npm-badge]][npm] | ||
![size](https://badgen.net/bundlephobia/minzip/@formatjs/intl-listformat) | ||
## Installation | ||
``` | ||
npm install @formatjs/intl-listformat | ||
``` | ||
## Usage | ||
To use the polyfill, just import it to make sure that a fully functional Intl.ListFormat is available in your environment: | ||
``` | ||
import '@formatjs/intl-listformat/polyfill' | ||
``` | ||
If Intl.ListFormat already exists, the polyfill will not be loaded. | ||
To use this as a ponyfill: | ||
``` | ||
import IntlListFormat from '@formatjs/intl-listformat' | ||
``` | ||
By default, this library comes with `en` data. To load additional locale, you can include them on demand: | ||
```js | ||
import '@formatjs/intl-listformat/polyfill'; | ||
import '@formatjs/intl-listformat/dist/locale-data/de'; // Add locale data for de | ||
``` | ||
If you want to polyfill all locales (e.g for Node): | ||
``` | ||
import '@formatjs/intl-listformat/polyfill-locales' | ||
``` | ||
## Tests | ||
This library is fully [test262](https://github.com/tc39/test262/tree/master/test/intl402/ListFormat)-compliant. | ||
[npm]: https://www.npmjs.org/package/@formatjs/intl-listformat | ||
[npm-badge]: https://img.shields.io/npm/v/@formatjs/intl-listformat.svg?style=flat-square | ||
We've migrated the docs to https://formatjs.io. |
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 too big to display
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
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
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
5507171
13214
4
2
4
Updated@formatjs/intl-utils@^2.2.4