resolve-accept-language 3.2.0 → 3.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/cjs/directives.js +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/locales.js +1 -1
- package/dist/cjs/package.json +1 -1
- package/dist/esm/directives.js +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/locales.js +1 -1
- package/package.json +14 -14
package/README.md
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://opensource.org/licenses/MIT)
|
|
4
4
|
[](https://www.npmjs.com/package/resolve-accept-language)
|
|
5
|
-

|
|
6
|
+

|
|
7
7
|

|
|
8
8
|
|
|
9
9
|
Resolve the best locale based on the value of an `Accept-Language` HTTP header.
|
package/dist/cjs/directives.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";function _array_like_to_array(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,a=new Array(r);t<r;t++)a[t]=e[t];return a}function _array_without_holes(e){if(Array.isArray(e))return _array_like_to_array(e)}function _iterable_to_array(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _non_iterable_spread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _to_consumable_array(e){return _array_without_holes(e)||_iterable_to_array(e)||_unsupported_iterable_to_array(e)||_non_iterable_spread()}function _unsupported_iterable_to_array(e,r){if(e){if("string"==typeof e)return _array_like_to_array(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(t):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_array_like_to_array(e,r):void 0}}Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"getDirectives",{enumerable:!0,get:function(){return getDirectives}});var REGEX_DIRECTIVE=/^(([a-z]{2})(-([a-z]{2}|419))?)(;q=((1(\.0{0,3})?)|(0(\.\d{0,3})?)))?$/i,getDirective=function(e){var r=e.match(REGEX_DIRECTIVE);if(r){var t=r[2],a=r[4],o=r[6],n=t.toLowerCase(),i=a?a.toUpperCase():void 0;if("419"!==i||"es"===n){var s=void 0===o?1:Number(o);return{languageCode:n,countryCode:i,locale:i?"".concat(n,"-").concat(i):void 0,quality:s}}}},getDirectives=function(e){var r=[],t=0;e.split(",").forEach(function(e){var a=getDirective(e.trim());a&&(r.some(function(e){return e.languageCode===a.languageCode&&e.locale===a.locale})||(r.push(Object.assign(Object.assign({},a),{headerPosition:t})),t++))});var a=r.map(function(e){return e.locale}).indexOf("es-419");if(-1!==a){var o,n=r[a],i=["es-AR","es-CL","es-CO","es-CR","es-HN","es-MX","es-PE","es-US","es-UY","es-VE"].map(function(e){return Object.assign(Object.assign({},n),{locale:e})});(o=r).splice.apply(o,[a,1].concat(_to_consumable_array(i)))}return r.sort(function(e,r){var t=r.quality-e.quality;return t||e.headerPosition-r.headerPosition})};
|
package/dist/cjs/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";function _export(e,r){for(var t in r)Object.defineProperty(e,t,{enumerable:!0,get:Object.getOwnPropertyDescriptor(r,t).get})}Object.defineProperty(exports,"__esModule",{value:!0}),_export(exports,{get MATCH_TYPES(){return MATCH_TYPES},get resolveAcceptLanguage(){return resolveAcceptLanguage}});var _directives=require("./directives.js"),_locales=require("./locales.js");function _array_like_to_array(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,a=new Array(r);t<r;t++)a[t]=e[t];return a}function _array_without_holes(e){if(Array.isArray(e))return _array_like_to_array(e)}function _iterable_to_array(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _non_iterable_spread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _to_consumable_array(e){return _array_without_holes(e)||_iterable_to_array(e)||_unsupported_iterable_to_array(e)||_non_iterable_spread()}function _unsupported_iterable_to_array(e,r){if(e){if("string"==typeof e)return _array_like_to_array(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(t):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_array_like_to_array(e,r):void 0}}var MATCH_TYPES={locale:"locale",languageSpecificLocale:"languageSpecificLocale",language:"language",relatedLocale:"relatedLocale",languageCountry:"languageCountry",country:"country",defaultLocale:"defaultLocale"},resolveAcceptLanguage=function(e,r,t,a){if(r.forEach(function(e){if(!(0,_locales.isLocale)(e,!1))throw new Error("Invalid locale identifier '".concat(e,"'. A valid locale should follow the BCP 47 'language-country' format."))}),!(0,_locales.isLocale)(t,!1))throw new Error("Invalid default locale identifier '".concat(t,"'. A valid locale should follow the BCP 47 'language-country' format."));if(!r.some(function(e){return e.toLowerCase()===t.toLowerCase()}))throw new Error("The default locale '".concat(t,"' must be included in the locales array because it is used as a fallback when no match is found."));var o=new _locales.Locale(t),n=[o.identifier].concat(_to_consumable_array(r.map(function(e){return new _locales.Locale(e).identifier}))),l=function(){var r=new _locales.LocaleList(n),t=(0,_directives.getDirectives)(e),l=t.filter(function(e){return e.languageCode in r.languages}),i=!0,c=!1,u=void 0;try{for(var f,y=l[Symbol.iterator]();!(i=(f=y.next()).done);i=!0){var d=f.value,_=d.locale,v=d.languageCode;if(void 0===_){var s=!0,g=!1,h=void 0;try{for(var m,p=t[Symbol.iterator]();!(s=(m=p.next()).done);s=!0){var b=m.value;if(b.languageCode===v&&void 0!==b.locale&&b.locale in r.locales)return{match:b.locale,matchType:MATCH_TYPES.languageSpecificLocale}}}catch(e){g=!0,h=e}finally{try{s||null==p.return||p.return()}finally{if(g)throw h}}var C=!0,T=!1,w=void 0;try{for(var S,A=r.objects[Symbol.iterator]();!(C=(S=A.next()).done);C=!0){var L=S.value;if(L.languageCode===v)return{match:L.identifier,matchType:MATCH_TYPES.language}}}catch(e){T=!0,w=e}finally{try{C||null==A.return||A.return()}finally{if(T)throw w}}}else if(_ in r.locales)return{match:_,matchType:MATCH_TYPES.locale}}}catch(e){c=!0,u=e}finally{try{i||null==y.return||y.return()}finally{if(c)throw u}}var E=!0,P=!1,x=void 0;try{for(var M,j=l[Symbol.iterator]();!(E=(M=j.next()).done);E=!0){var H=M.value,Y=!0,O=!1,k=void 0;try{for(var I,q=r.objects[Symbol.iterator]();!(Y=(I=q.next()).done);Y=!0){var B=I.value;if(B.languageCode===H.languageCode)return{match:B.identifier,matchType:MATCH_TYPES.relatedLocale}}}catch(e){O=!0,k=e}finally{try{Y||null==q.return||q.return()}finally{if(O)throw k}}}}catch(e){P=!0,x=e}finally{try{E||null==j.return||j.return()}finally{if(P)throw x}}var D=r.objects.filter(function(e){return e.languageCode===o.languageCode&&e.identifier!==o.identifier}).map(function(e){return e.countryCode});if(D.length>0){var U=!0,$=!1,z=void 0;try{for(var F,G=t[Symbol.iterator]();!(U=(F=G.next()).done);U=!0){var J=F.value;if(void 0!==J.locale&&void 0!==J.countryCode&&-1!==D.indexOf(J.countryCode))return{match:"".concat(o.languageCode,"-").concat(J.countryCode),matchType:MATCH_TYPES.languageCountry}}}catch(e){$=!0,z=e}finally{try{U||null==G.return||G.return()}finally{if($)throw z}}}if(null==a?void 0:a.matchCountry){var K=!0,N=!1,Q=void 0;try{for(var R,V=t[Symbol.iterator]();!(K=(R=V.next()).done);K=!0){var W=R.value,X=!0,Z=!1,ee=void 0;try{for(var re,te=r.objects[Symbol.iterator]();!(X=(re=te.next()).done);X=!0){var ae=re.value;if(ae.countryCode===W.countryCode)return{match:ae.identifier,matchType:MATCH_TYPES.country}}}catch(e){Z=!0,ee=e}finally{try{X||null==te.return||te.return()}finally{if(Z)throw ee}}}}catch(e){N=!0,Q=e}finally{try{K||null==V.return||V.return()}finally{if(N)throw Q}}}return{match:o.identifier,matchType:MATCH_TYPES.defaultLocale}}();return(null==a?void 0:a.returnMatchType)?l:l.match};
|
package/dist/cjs/locales.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";function _export(t,e){for(var r in e)Object.defineProperty(t,r,{enumerable:!0,get:Object.getOwnPropertyDescriptor(e,r).get})}function _instanceof(t,e){return null!=e&&"undefined"!=typeof Symbol&&e[Symbol.hasInstance]?!!e[Symbol.hasInstance](t):t instanceof e}function _array_like_to_array(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,a=new Array(e);r<e;r++)a[r]=t[r];return a}function _array_with_holes(t){if(Array.isArray(t))return t}function _class_call_check(t,e){if(!_instanceof(t,e))throw new TypeError("Cannot call a class as a function")}function _iterable_to_array_limit(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var a,n,o=[],i=!0,l=!1;try{for(r=r.call(t);!(i=(a=r.next()).done)&&(o.push(a.value),!e||o.length!==e);i=!0);}catch(t){l=!0,n=t}finally{try{i||null==r.return||r.return()}finally{if(l)throw n}}return o}}function _non_iterable_rest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _sliced_to_array(t,e){return _array_with_holes(t)||_iterable_to_array_limit(t,e)||_unsupported_iterable_to_array(t,e)||_non_iterable_rest()}function _unsupported_iterable_to_array(t,e){if(t){if("string"==typeof t)return _array_like_to_array(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(r):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_array_like_to_array(t,e):void 0}}Object.defineProperty(exports,"__esModule",{value:!0}),_export(exports,{get Locale(){return Locale},get LocaleList(){return LocaleList},get isLocale(){return isLocale}});var Locale=function t(e){if(_class_call_check(this,t),!isLocale(e,!1))throw new Error("invalid locale identifier '".concat(e,"'"));var r=_sliced_to_array(e.split("-"),2),a=r[0],n=r[1];this.languageCode=a.toLowerCase(),this.countryCode=n.toUpperCase(),this.identifier="".concat(this.languageCode,"-").concat(this.countryCode)},LocaleList=function t(e){_class_call_check(this,t),this.languages={},this.countries={},this.locales={},this.objects=[];var r=!0,a=!1,n=void 0;try{for(var o,i=e[Symbol.iterator]();!(r=(o=i.next()).done);r=!0){var l=o.value,c=new Locale(l);c.identifier in this.locales||(this.objects.push(c),this.locales[c.identifier]=!0,this.languages[c.languageCode]=!0,this.countries[c.countryCode]=!0)}}catch(t){a=!0,n=t}finally{try{r||null==i.return||i.return()}finally{if(a)throw n}}},REGEX_LOCALE_CASE_NORMALIZED=/^[a-z]{2}-[A-Z]{2}$/,REGEX_LOCALE_CASE_INSENSITIVE=/^[a-z]{2}-[A-Z]{2}$/i,isLocale=function(t){return(!(arguments.length>1&&void 0!==arguments[1])||arguments[1]?REGEX_LOCALE_CASE_NORMALIZED:REGEX_LOCALE_CASE_INSENSITIVE).test(t)};
|
package/dist/cjs/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{ "type": "commonjs" }
|
|
1
|
+
{ "type": "commonjs" }
|
package/dist/esm/directives.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function _array_like_to_array(r,e){(null==e||e>r.length)&&(e=r.length);for(var t=0,a=new Array(e);t<e;t++)a[t]=r[t];return a}function _array_without_holes(r){if(Array.isArray(r))return _array_like_to_array(r)}function _iterable_to_array(r){if("undefined"!=typeof Symbol&&null!=r[Symbol.iterator]||null!=r["@@iterator"])return Array.from(r)}function _non_iterable_spread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _to_consumable_array(r){return _array_without_holes(r)||_iterable_to_array(r)||_unsupported_iterable_to_array(r)||_non_iterable_spread()}function _unsupported_iterable_to_array(r,e){if(r){if("string"==typeof r)return _array_like_to_array(r,e);var t=Object.prototype.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(t):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_array_like_to_array(r,e):void 0}}var REGEX_DIRECTIVE=/^(([a-z]{2})(-([a-z]{2}|419))?)(;q=((1(\.0{0,3})?)|(0(\.\d{0,3})?)))?$/i,getDirective=function(r){var e=r.match(REGEX_DIRECTIVE);if(e){var t=e[2],a=e[4],o=e[6],n=t.toLowerCase(),i=a?a.toUpperCase():void 0;if("419"!==i||"es"===n){var l=void 0===o?1:Number(o);return{languageCode:n,countryCode:i,locale:i?"".concat(n,"-").concat(i):void 0,quality:l}}}};export var getDirectives=function(r){var e=[],t=0;r.split(",").forEach(function(r){var a=getDirective(r.trim());a&&(e.some(function(r){return r.languageCode===a.languageCode&&r.locale===a.locale})||(e.push(Object.assign(Object.assign({},a),{headerPosition:t})),t++))});var a=e.map(function(r){return r.locale}).indexOf("es-419");if(-1!==a){var o,n=e[a],i=["es-AR","es-CL","es-CO","es-CR","es-HN","es-MX","es-PE","es-US","es-UY","es-VE"].map(function(r){return Object.assign(Object.assign({},n),{locale:r})});(o=e).splice.apply(o,[a,1].concat(_to_consumable_array(i)))}return e.sort(function(r,e){var t=e.quality-r.quality;return t||r.headerPosition-e.headerPosition})};
|
package/dist/esm/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function _array_like_to_array(r,e){(null==e||e>r.length)&&(e=r.length);for(var a=0,t=new Array(e);a<e;a++)t[a]=r[a];return t}function _array_without_holes(r){if(Array.isArray(r))return _array_like_to_array(r)}function _iterable_to_array(r){if("undefined"!=typeof Symbol&&null!=r[Symbol.iterator]||null!=r["@@iterator"])return Array.from(r)}function _non_iterable_spread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _to_consumable_array(r){return _array_without_holes(r)||_iterable_to_array(r)||_unsupported_iterable_to_array(r)||_non_iterable_spread()}function _unsupported_iterable_to_array(r,e){if(r){if("string"==typeof r)return _array_like_to_array(r,e);var a=Object.prototype.toString.call(r).slice(8,-1);return"Object"===a&&r.constructor&&(a=r.constructor.name),"Map"===a||"Set"===a?Array.from(a):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?_array_like_to_array(r,e):void 0}}import{getDirectives}from"./directives.js";import{isLocale,Locale,LocaleList}from"./locales.js";export var MATCH_TYPES={locale:"locale",languageSpecificLocale:"languageSpecificLocale",language:"language",relatedLocale:"relatedLocale",languageCountry:"languageCountry",country:"country",defaultLocale:"defaultLocale"};export var resolveAcceptLanguage=function(r,e,a,t){if(e.forEach(function(r){if(!isLocale(r,!1))throw new Error("Invalid locale identifier '".concat(r,"'. A valid locale should follow the BCP 47 'language-country' format."))}),!isLocale(a,!1))throw new Error("Invalid default locale identifier '".concat(a,"'. A valid locale should follow the BCP 47 'language-country' format."));if(!e.some(function(r){return r.toLowerCase()===a.toLowerCase()}))throw new Error("The default locale '".concat(a,"' must be included in the locales array because it is used as a fallback when no match is found."));var o=new Locale(a),n=[o.identifier].concat(_to_consumable_array(e.map(function(r){return new Locale(r).identifier}))),l=function(){var e=new LocaleList(n),a=getDirectives(r),l=a.filter(function(r){return r.languageCode in e.languages}),i=!0,c=!1,u=void 0;try{for(var f,y=l[Symbol.iterator]();!(i=(f=y.next()).done);i=!0){var d=f.value,v=d.locale,_=d.languageCode;if(void 0===v){var h=!0,g=!1,s=void 0;try{for(var m,p=a[Symbol.iterator]();!(h=(m=p.next()).done);h=!0){var b=m.value;if(b.languageCode===_&&void 0!==b.locale&&b.locale in e.locales)return{match:b.locale,matchType:MATCH_TYPES.languageSpecificLocale}}}catch(r){g=!0,s=r}finally{try{h||null==p.return||p.return()}finally{if(g)throw s}}var C=!0,w=!1,T=void 0;try{for(var S,L=e.objects[Symbol.iterator]();!(C=(S=L.next()).done);C=!0){var A=S.value;if(A.languageCode===_)return{match:A.identifier,matchType:MATCH_TYPES.language}}}catch(r){w=!0,T=r}finally{try{C||null==L.return||L.return()}finally{if(w)throw T}}}else if(v in e.locales)return{match:v,matchType:MATCH_TYPES.locale}}}catch(r){c=!0,u=r}finally{try{i||null==y.return||y.return()}finally{if(c)throw u}}var E=!0,x=!1,M=void 0;try{for(var P,j=l[Symbol.iterator]();!(E=(P=j.next()).done);E=!0){var H=P.value,Y=!0,k=!1,I=void 0;try{for(var O,B=e.objects[Symbol.iterator]();!(Y=(O=B.next()).done);Y=!0){var D=O.value;if(D.languageCode===H.languageCode)return{match:D.identifier,matchType:MATCH_TYPES.relatedLocale}}}catch(r){k=!0,I=r}finally{try{Y||null==B.return||B.return()}finally{if(k)throw I}}}}catch(r){x=!0,M=r}finally{try{E||null==j.return||j.return()}finally{if(x)throw M}}var U=e.objects.filter(function(r){return r.languageCode===o.languageCode&&r.identifier!==o.identifier}).map(function(r){return r.countryCode});if(U.length>0){var $=!0,q=!1,z=void 0;try{for(var F,G=a[Symbol.iterator]();!($=(F=G.next()).done);$=!0){var J=F.value;if(void 0!==J.locale&&void 0!==J.countryCode&&-1!==U.indexOf(J.countryCode))return{match:"".concat(o.languageCode,"-").concat(J.countryCode),matchType:MATCH_TYPES.languageCountry}}}catch(r){q=!0,z=r}finally{try{$||null==G.return||G.return()}finally{if(q)throw z}}}if(null==t?void 0:t.matchCountry){var K=!0,N=!1,Q=void 0;try{for(var R,V=a[Symbol.iterator]();!(K=(R=V.next()).done);K=!0){var W=R.value,X=!0,Z=!1,rr=void 0;try{for(var er,ar=e.objects[Symbol.iterator]();!(X=(er=ar.next()).done);X=!0){var tr=er.value;if(tr.countryCode===W.countryCode)return{match:tr.identifier,matchType:MATCH_TYPES.country}}}catch(r){Z=!0,rr=r}finally{try{X||null==ar.return||ar.return()}finally{if(Z)throw rr}}}}catch(r){N=!0,Q=r}finally{try{K||null==V.return||V.return()}finally{if(N)throw Q}}}return{match:o.identifier,matchType:MATCH_TYPES.defaultLocale}}();return(null==t?void 0:t.returnMatchType)?l:l.match};
|
package/dist/esm/locales.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
function _array_like_to_array(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,a=new Array(r);e<r;e++)a[e]=t[e];return a}function _array_with_holes(t){if(Array.isArray(t))return t}function _class_call_check(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function _iterable_to_array_limit(t,r){var e=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=e){var a,n,o=[],i=!0,l=!1;try{for(e=e.call(t);!(i=(a=e.next()).done)&&(o.push(a.value),!r||o.length!==r);i=!0);}catch(t){l=!0,n=t}finally{try{i||null==e.return||e.return()}finally{if(l)throw n}}return o}}function _non_iterable_rest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _sliced_to_array(t,r){return _array_with_holes(t)||_iterable_to_array_limit(t,r)||_unsupported_iterable_to_array(t,r)||_non_iterable_rest()}function _unsupported_iterable_to_array(t,r){if(t){if("string"==typeof t)return _array_like_to_array(t,r);var e=Object.prototype.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(e):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?_array_like_to_array(t,r):void 0}}export var Locale=function t(r){"use strict";if(_class_call_check(this,t),!isLocale(r,!1))throw new Error("invalid locale identifier '".concat(r,"'"));var e=_sliced_to_array(r.split("-"),2),a=e[0],n=e[1];this.languageCode=a.toLowerCase(),this.countryCode=n.toUpperCase(),this.identifier="".concat(this.languageCode,"-").concat(this.countryCode)};export var LocaleList=function t(r){"use strict";_class_call_check(this,t),this.languages={},this.countries={},this.locales={},this.objects=[];var e=!0,a=!1,n=void 0;try{for(var o,i=r[Symbol.iterator]();!(e=(o=i.next()).done);e=!0){var l=o.value,c=new Locale(l);c.identifier in this.locales||(this.objects.push(c),this.locales[c.identifier]=!0,this.languages[c.languageCode]=!0,this.countries[c.countryCode]=!0)}}catch(t){a=!0,n=t}finally{try{e||null==i.return||i.return()}finally{if(a)throw n}}};var REGEX_LOCALE_CASE_NORMALIZED=/^[a-z]{2}-[A-Z]{2}$/,REGEX_LOCALE_CASE_INSENSITIVE=/^[a-z]{2}-[A-Z]{2}$/i;export var isLocale=function(t){return(!(arguments.length>1&&void 0!==arguments[1])||arguments[1]?REGEX_LOCALE_CASE_NORMALIZED:REGEX_LOCALE_CASE_INSENSITIVE).test(t)};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "resolve-accept-language",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.1",
|
|
4
4
|
"description": "Resolve the preferred locale based on the value of an `Accept-Language` HTTP header.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"accept-language",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"dist"
|
|
44
44
|
],
|
|
45
45
|
"scripts": {
|
|
46
|
-
"build": "npm run check-nvm-node-version && npm run prettier-write && npm run eslint-fix && rm -Rf ./dist && tsc
|
|
46
|
+
"build": "npm run check-nvm-node-version && npm run prettier-write && npm run eslint-fix && rm -Rf ./dist && tsc && npx tsx src/build-scripts/build.ts && npm run test",
|
|
47
47
|
"check-nvm-node-version": "check-node-version --node $(node -p \"'>=' + require('fs').readFileSync('.nvmrc', 'utf-8').trim()\")",
|
|
48
48
|
"depcheck": "depcheck",
|
|
49
49
|
"eslint-fix": "eslint --fix",
|
|
@@ -57,34 +57,34 @@
|
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@release-it/conventional-changelog": "10.0.6",
|
|
60
|
+
"@swc/core": "1.15.24",
|
|
60
61
|
"@types/jest": "30.0.0",
|
|
61
|
-
"@types/node": "25.5.
|
|
62
|
+
"@types/node": "25.5.2",
|
|
62
63
|
"check-node-version": "4.2.1",
|
|
63
64
|
"depcheck": "1.4.7",
|
|
64
65
|
"dotenv-cli": "11.0.0",
|
|
65
|
-
"eslint": "10.0
|
|
66
|
+
"eslint": "10.2.0",
|
|
66
67
|
"eslint-config-prettier": "10.1.8",
|
|
67
68
|
"eslint-import-resolver-typescript": "4.4.4",
|
|
68
|
-
"eslint-plugin-es-x": "9.
|
|
69
|
+
"eslint-plugin-es-x": "9.6.0",
|
|
69
70
|
"eslint-plugin-import-x": "4.16.2",
|
|
70
|
-
"eslint-plugin-jest": "29.15.
|
|
71
|
-
"eslint-plugin-package-json": "0.91.
|
|
71
|
+
"eslint-plugin-jest": "29.15.1",
|
|
72
|
+
"eslint-plugin-package-json": "0.91.1",
|
|
72
73
|
"eslint-plugin-prefer-arrow-functions": "3.9.1",
|
|
73
74
|
"eslint-plugin-prettier": "5.5.5",
|
|
74
75
|
"eslint-plugin-tsdoc": "0.5.2",
|
|
75
|
-
"eslint-plugin-unicorn": "
|
|
76
|
+
"eslint-plugin-unicorn": "64.0.0",
|
|
76
77
|
"husky": "9.1.7",
|
|
77
78
|
"jest": "30.3.0",
|
|
78
79
|
"jiti": "2.6.1",
|
|
79
80
|
"jsonc-eslint-parser": "3.1.0",
|
|
80
|
-
"npm-check-updates": "
|
|
81
|
+
"npm-check-updates": "20.0.0",
|
|
81
82
|
"prettier": "3.8.1",
|
|
82
|
-
"prettier-plugin-organize-imports": "4.3.0",
|
|
83
83
|
"release-it": "19.2.4",
|
|
84
|
-
"terser": "5.46.
|
|
85
|
-
"ts-jest": "29.4.
|
|
86
|
-
"typescript": "
|
|
87
|
-
"typescript-eslint": "8.
|
|
84
|
+
"terser": "5.46.1",
|
|
85
|
+
"ts-jest": "29.4.9",
|
|
86
|
+
"typescript": "6.0.2",
|
|
87
|
+
"typescript-eslint": "8.58.0"
|
|
88
88
|
},
|
|
89
89
|
"engines": {
|
|
90
90
|
"node": ">=4.0.0"
|