is-language-code 4.0.4 → 4.0.10

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.
@@ -1,6 +1,7 @@
1
1
  // Quick Take
2
2
 
3
3
  import { strict as assert } from "assert";
4
+
4
5
  import { isLangCode } from "../dist/is-language-code.esm.js";
5
6
 
6
7
  assert.deepEqual(isLangCode("de-419-DE"), {
@@ -1,6 +1,7 @@
1
1
  // Various examples
2
2
 
3
3
  import { strict as assert } from "assert";
4
+
4
5
  import { isLangCode } from "../dist/is-language-code.esm.js";
5
6
 
6
7
  assert.equal(isLangCode("de").res, true);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "is-language-code",
3
- "version": "4.0.4",
3
+ "version": "4.0.10",
4
4
  "description": "Is given string a language code (as per IANA)",
5
5
  "keywords": [
6
6
  "check",
@@ -39,93 +39,34 @@
39
39
  },
40
40
  "types": "types/index.d.ts",
41
41
  "scripts": {
42
- "build": "rollup -c",
43
- "ci_test": "npm run build && npm run format && tap --no-only --reporter=silent --output-file=testStats.md && npm run clean_cov",
44
- "clean_cov": "../../scripts/leaveCoverageTotalOnly.js",
45
- "clean_types": "../../scripts/cleanTypes.js",
46
- "dev": "rollup -c --dev",
47
- "devunittest": "npm run dev && tap --only -R 'base'",
48
- "esbuild": "node '../../scripts/esbuild.js'",
49
- "esbuild_dev": "cross-env MODE=dev node '../../scripts/esbuild.js'",
50
- "format": "npm run lect && npm run prettier && npm run lint",
51
- "lect": "lect",
52
- "lint": "../../node_modules/eslint/bin/eslint.js . --ext .js --ext .ts --fix --config \"../../.eslintrc.json\" --quiet",
53
- "perf": "node perf/check",
54
- "prettier": "../../node_modules/prettier/bin-prettier.js '*.{js,css,scss,vue,md,ts}' --write --loglevel silent",
55
- "republish": "npm publish || :",
56
- "tap": "tap",
57
- "pretest": "npm run build",
58
- "test": "npm run lint && npm run unittest && npm run test:examples && npm run clean_cov && npm run format",
59
- "test:examples": "../../scripts/test-examples.js && npm run lect && npm run prettier",
60
- "tsc": "tsc",
61
- "unittest": "tap --no-only --output-file=testStats.md --reporter=terse && tsc -p tsconfig.json --noEmit && npm run clean_cov && npm run perf"
42
+ "build": "node '../../ops/scripts/esbuild.js' && yarn run dts",
43
+ "dev": "DEV=true node '../../ops/scripts/esbuild.js' && yarn run dts",
44
+ "dts": "rollup -c",
45
+ "examples": "node '../../ops/scripts/run-examples.js'",
46
+ "lect": "node '../../ops/lect/lect.js'",
47
+ "letspublish": "yarn publish || :",
48
+ "lint": "eslint . --fix",
49
+ "perf": "node perf/check.js",
50
+ "prepare": "echo 'ready'",
51
+ "pretest": "yarn run lect && yarn run build",
52
+ "test": "c8 yarn run unit && yarn run examples && yarn run lint",
53
+ "unit": "uvu test"
62
54
  },
63
- "tap": {
64
- "check-coverage": false,
65
- "coverage-report": [
66
- "json-summary",
67
- "text"
68
- ],
69
- "node-arg": [
70
- "--no-warnings",
71
- "--experimental-loader",
72
- "@istanbuljs/esm-loader-hook"
55
+ "engines": {
56
+ "node": "^12.20.0 || ^14.13.1 || >=16.0.0"
57
+ },
58
+ "c8": {
59
+ "check-coverage": true,
60
+ "exclude": [
61
+ "**/test/**/*.*"
73
62
  ],
74
- "timeout": 0
63
+ "lines": 100
75
64
  },
76
65
  "lect": {
77
66
  "licence": {
78
67
  "extras": [
79
68
  ""
80
69
  ]
81
- },
82
- "req": "{ isLangCode }",
83
- "various": {
84
- "devDependencies": []
85
70
  }
86
- },
87
- "dependencies": {
88
- "@babel/runtime": "^7.16.0"
89
- },
90
- "devDependencies": {
91
- "@babel/cli": "^7.16.0",
92
- "@babel/core": "^7.16.0",
93
- "@babel/node": "^7.16.0",
94
- "@babel/plugin-external-helpers": "^7.16.0",
95
- "@babel/plugin-proposal-class-properties": "^7.16.0",
96
- "@babel/plugin-proposal-nullish-coalescing-operator": "^7.16.0",
97
- "@babel/plugin-proposal-object-rest-spread": "^7.16.0",
98
- "@babel/plugin-proposal-optional-chaining": "^7.16.0",
99
- "@babel/plugin-transform-runtime": "^7.16.0",
100
- "@babel/preset-env": "^7.16.0",
101
- "@babel/preset-typescript": "^7.16.0",
102
- "@babel/register": "^7.16.0",
103
- "@istanbuljs/esm-loader-hook": "^0.1.2",
104
- "@rollup/plugin-babel": "^5.3.0",
105
- "@rollup/plugin-commonjs": "^21.0.1",
106
- "@rollup/plugin-json": "^4.1.0",
107
- "@rollup/plugin-node-resolve": "^13.0.6",
108
- "@rollup/plugin-strip": "^2.1.0",
109
- "@rollup/plugin-typescript": "^8.3.0",
110
- "@types/node": "^16.11.6",
111
- "@types/tap": "^15.0.5",
112
- "@typescript-eslint/eslint-plugin": "^5.3.0",
113
- "@typescript-eslint/parser": "^5.3.0",
114
- "core-js": "^3.19.1",
115
- "cross-env": "^7.0.3",
116
- "eslint": "^8.1.0",
117
- "lect": "^0.18.4",
118
- "rollup": "^2.59.0",
119
- "rollup-plugin-ascii": "^0.0.3",
120
- "rollup-plugin-banner": "^0.2.1",
121
- "rollup-plugin-cleanup": "^3.2.1",
122
- "rollup-plugin-dts": "^4.0.0",
123
- "rollup-plugin-terser": "^7.0.2",
124
- "tap": "^15.0.10",
125
- "tslib": "^2.3.1",
126
- "typescript": "^4.4.4"
127
- },
128
- "engines": {
129
- "node": ">=12"
130
71
  }
131
72
  }
package/types/index.d.ts CHANGED
File without changes
package/examples/api.json DELETED
@@ -1 +0,0 @@
1
- {"_quickTake.js":{"title":"Quick Take","content":"import { strict as assert } from \"assert\";\nimport { isLangCode } from \"is-language-code\";\n\nassert.deepEqual(isLangCode(\"de-419-DE\"), {\n res: false,\n message: 'Two region subtags, \"419\" and \"de\".',\n});\n\nassert.deepEqual(isLangCode(\"sr-Latn\"), {\n res: true,\n message: null,\n});"},"various.js":{"title":"Various examples","content":"import { strict as assert } from \"assert\";\nimport { isLangCode } from \"is-language-code\";\n\nassert.equal(isLangCode(\"de\").res, true);\n// => true because it's a German language code\n\nassert.equal(isLangCode(\"fr\").res, true);\n// => true because it's a French language code\n\nassert.equal(isLangCode(\"ja\").res, true);\n// => true because it's a Japanese language code\n\nassert.equal(isLangCode(\"zzz\").res, false);\n// => false - unrecognised. npm package \"ietf-language-tag-regex\" would fail this\n\nassert.equal(isLangCode(\"1\").res, false);\n// => false - not recognised language code\n\nassert.equal(isLangCode(\"x-klingon\").res, true);\n// => true - private use\n\nassert.equal(isLangCode(\"x-whatever\").res, true);\n// => true - private use\n\nassert.equal(isLangCode(\"zh-Hant\").res, true);\n// => true - Chinese written using the Traditional Chinese script\n\nassert.equal(isLangCode(\"zh-cmn-Hans-CN\").res, true);\n// => true - Chinese, Mandarin, Simplified script, as used in China\n\nassert.equal(isLangCode(\"zh-Hans-CN\").res, true);\n// => true - Chinese written using the Simplified script as used in mainland China\n\nassert.equal(isLangCode(\"sr-Latn-RS\").res, true);\n// => true - Serbian written using the Latin script as used in Serbia\n\nassert.equal(isLangCode(\"sl-rozaj\").res, true);\n// => true - Resian dialect of Slovenian\n\nassert.equal(isLangCode(\"sl-nedis\").res, true);\n// => true - Nadiza dialect of Slovenian\n\nassert.equal(isLangCode(\"de-CH-1901\").res, true);\n// => true - German as used in Switzerland using the 1901 variant [orthography]\n\nassert.equal(isLangCode(\"sl-IT-nedis\").res, true);\n// => true - Slovenian as used in Italy, Nadiza dialect\n\nassert.equal(isLangCode(\"hy-Latn-IT-arevela\").res, true);\n// => true - Eastern Armenian written in Latin script, as used in Italy\n\nassert.equal(isLangCode(\"en-US\").res, true);\n// => true - English as used in the United States\n\nassert.equal(isLangCode(\"de-CH-x-phonebk\").res, true);\n// => true - private use subtag (x-)\n\nassert.equal(isLangCode(\"az-Arab-x-AZE-derbend\").res, true);\n// => true - private use subtag\n\nassert.equal(isLangCode(\"x-whatever\").res, true);\n// => true - private use subtag using singleton x-\n\nassert.equal(isLangCode(\"qaa-Qaaa-QM-x-southern\").res, true);\n// => true\n\nassert.equal(isLangCode(\"de-Qaaa\").res, true);\n// => true - private use script subtag (Qaaa)\n\nassert.equal(isLangCode(\"sr-Latn-QM\").res, true);\n// => true - Serbian, Latin script, private region QM\n\nassert.equal(isLangCode(\"en-US-u-islamcal\").res, true);\n// => true - tag with extension\n\nassert.equal(isLangCode(\"zh-CN-a-myext-x-private\").res, true);\n// => true - tag with extension\n\nassert.equal(isLangCode(\"en-a-myext-b-another\").res, true);\n// => true - tag with extension\n\nassert.equal(isLangCode(\"de-419-DE\").res, false);\n// => false - two region tags\n\nassert.equal(isLangCode(\"a-DE\").res, false);\n// => false - use of a single-character subtag in primary position\n\nassert.equal(isLangCode(\"ar-a-aaa-b-bbb-a-ccc\").res, false);\n// => false - two extensions with same single-letter prefix"}}