resolve-accept-language
Advanced tools
Comparing version 1.1.13 to 1.1.14
{ | ||
"name": "resolve-accept-language", | ||
"version": "1.1.13", | ||
"version": "1.1.14", | ||
"description": "Resolve the preferred locale based on the value of an `Accept-Language` HTTP header.", | ||
@@ -14,6 +14,6 @@ "author": "Avansai (https://avansai.com)", | ||
"build": "rm -Rf ./lib && tsc && npm run lint && npm test", | ||
"lint": "eslint --ext .js --ext .jsx --ext .ts --ext .tsx --fix .", | ||
"lint-print-config": "eslint --print-config ./eslintrc.yaml", | ||
"prettier": "prettier --write .", | ||
"test": "jest --coverage", | ||
"lint": "eslint . --fix", | ||
"prettier-check": "prettier --check .", | ||
"prettier-fix": "prettier --write .", | ||
"release": "dotenv -- release-it --only-version" | ||
@@ -47,6 +47,11 @@ }, | ||
"eslint-config-prettier": "^8.5.0", | ||
"eslint-plugin-jest": "^26.6.0", | ||
"eslint-import-resolver-node": "^0.3.6", | ||
"eslint-import-resolver-typescript": "^3.3.0", | ||
"eslint-plugin-import": "^2.26.0", | ||
"eslint-plugin-jest": "^26.7.0", | ||
"eslint-plugin-prettier": "^4.2.1", | ||
"jest": "^28.1.3", | ||
"prettier": "2.7.1", | ||
"release-it": "^15.1.4", | ||
"prettier": "^2.7.1", | ||
"prettier-plugin-organize-imports": "^3.0.0", | ||
"release-it": "^15.2.0", | ||
"ts-jest": "^28.0.7", | ||
@@ -53,0 +58,0 @@ "ts-node": "^10.9.1", |
@@ -22,7 +22,7 @@ # resolve-accept-language | ||
```ts | ||
import resolveAcceptLanguage from 'resolve-accept-language'; | ||
import resolveAcceptLanguage from 'resolve-accept-language' | ||
console.log( | ||
resolveAcceptLanguage('fr-CA;q=0.01,en-CA;q=0.1,en-US;q=0.001', ['en-US', 'fr-CA'], 'en-US') | ||
); | ||
) | ||
``` | ||
@@ -41,3 +41,3 @@ | ||
```ts | ||
import { ResolveAcceptLanguage } from 'resolve-accept-language'; | ||
import { ResolveAcceptLanguage } from 'resolve-accept-language' | ||
@@ -52,14 +52,14 @@ /** | ||
'fr-CA', | ||
]); | ||
]) | ||
if (resolveAcceptLanguage.hasMatch()) { | ||
const locale = resolveAcceptLanguage.getBestMatch() as string; | ||
console.log(`A locale was matched: ${locale}`); | ||
const locale = resolveAcceptLanguage.getBestMatch() as string | ||
console.log(`A locale was matched: ${locale}`) | ||
if (resolveAcceptLanguage.bestMatchIsLocaleBased()) { | ||
console.log('The match is locale-based'); | ||
console.log('The match is locale-based') | ||
} else if (resolveAcceptLanguage.bestMatchIsLanguageBased()) { | ||
console.log('The match is language-based'); | ||
console.log('The match is language-based') | ||
} else if (resolveAcceptLanguage.bestMatchIsRelatedLocaleBased()) { | ||
console.log('The match is related-locale-based'); | ||
console.log('The match is related-locale-based') | ||
} | ||
@@ -69,3 +69,3 @@ } | ||
if (resolveAcceptLanguage.hasNoMatch()) { | ||
console.log('No match found :('); | ||
console.log('No match found :(') | ||
} | ||
@@ -72,0 +72,0 @@ ``` |
35980
19