charcode-is-valid-xml-name-character 2.0.4 → 2.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.
- package/CHANGELOG.md +0 -20
- package/LICENSE +1 -1
- package/README.md +4 -1
- package/dist/charcode-is-valid-xml-name-character.esm.js +2 -21
- package/dist/charcode-is-valid-xml-name-character.umd.js +4 -4
- package/examples/_quickTake.js +1 -0
- package/package.json +22 -78
- package/types/index.d.ts +0 -0
- package/examples/api.json +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,26 +3,6 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
## 2.0.3 (2021-11-02)
|
|
7
|
-
|
|
8
|
-
### Bug Fixes
|
|
9
|
-
|
|
10
|
-
- bump TS and separate ESLint plugins away from this monorepo ([b1ebce1](https://github.com/codsen/codsen/commit/b1ebce1637d8c41c2d848fc24b0ba4058865bd5d))
|
|
11
|
-
|
|
12
|
-
### Features
|
|
13
|
-
|
|
14
|
-
- migrate to ES Modules ([c579dff](https://github.com/codsen/codsen/commit/c579dff3b23205e383035ca10ddcec671e35d0fe))
|
|
15
|
-
|
|
16
|
-
### BREAKING CHANGES
|
|
17
|
-
|
|
18
|
-
- programs now are in ES Modules and won't work with Common JS require()
|
|
19
|
-
|
|
20
|
-
## 2.0.1 (2021-09-13)
|
|
21
|
-
|
|
22
|
-
### Bug Fixes
|
|
23
|
-
|
|
24
|
-
- bump TS and separate ESLint plugins away from this monorepo ([2e07d42](https://github.com/codsen/codsen/commit/2e07d424222b6ffedf5fb45c83ad453627ec2904))
|
|
25
|
-
|
|
26
6
|
## 2.0.0 (2021-09-09)
|
|
27
7
|
|
|
28
8
|
### Features
|
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2010
|
|
3
|
+
Copyright (c) 2010-2021 Roy Revelt and other contributors
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
6
|
a copy of this software and associated documentation files (the
|
package/README.md
CHANGED
|
@@ -38,6 +38,7 @@ If you need a legacy version which works with `require`, use version 1.13.0
|
|
|
38
38
|
|
|
39
39
|
```js
|
|
40
40
|
import { strict as assert } from "assert";
|
|
41
|
+
|
|
41
42
|
import {
|
|
42
43
|
isProduction4,
|
|
43
44
|
isProduction4a,
|
|
@@ -62,7 +63,7 @@ assert.equal(validSecondCharOnwards("?"), false);
|
|
|
62
63
|
|
|
63
64
|
## Documentation
|
|
64
65
|
|
|
65
|
-
Please [visit codsen.com](https://codsen.com/os/charcode-is-valid-xml-name-character/) for a full description of the API
|
|
66
|
+
Please [visit codsen.com](https://codsen.com/os/charcode-is-valid-xml-name-character/) for a full description of the API.
|
|
66
67
|
|
|
67
68
|
## Contributing
|
|
68
69
|
|
|
@@ -74,4 +75,6 @@ MIT License
|
|
|
74
75
|
|
|
75
76
|
Copyright (c) 2010-2021 Roy Revelt and other contributors
|
|
76
77
|
|
|
78
|
+
|
|
77
79
|
<img src="https://codsen.com/images/png-codsen-ok.png" width="98" alt="ok" align="center"> <img src="https://codsen.com/images/png-codsen-1.png" width="148" alt="codsen" align="center"> <img src="https://codsen.com/images/png-codsen-star-small.png" width="32" alt="star" align="center">
|
|
80
|
+
|
|
@@ -1,29 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @name charcode-is-valid-xml-name-character
|
|
3
3
|
* @fileoverview Does a given character belong to XML spec's "Production 4 OR 4a" type (is acceptable for XML element's name)
|
|
4
|
-
* @version 2.0.
|
|
4
|
+
* @version 2.0.10
|
|
5
5
|
* @author Roy Revelt, Codsen Ltd
|
|
6
6
|
* @license MIT
|
|
7
7
|
* {@link https://codsen.com/os/charcode-is-valid-xml-name-character/}
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import
|
|
11
|
-
|
|
12
|
-
const nameStartChar = [[58, 58], [65, 90], [95, 95], [192, 214], [216, 246], [248, 767], [880, 893], [895, 8191], [8204, 8205], [8304, 8591], [11264, 12271], [12289, 55295], [63744, 64975], [65008, 65533], [65536, 983039]
|
|
13
|
-
];
|
|
14
|
-
const nameChar = [[45, 45], [46, 46], [48, 57], [58, 58], [65, 90], [95, 95], [183, 183], [192, 214], [216, 246], [248, 767], [768, 879], [880, 893], [895, 8191], [8204, 8205], [8255, 8256], [8304, 8591], [11264, 12271], [12289, 55295], [63744, 64975], [65008, 65533], [65536, 983039]
|
|
15
|
-
];
|
|
16
|
-
const priorityNameChar = [[97, 122]
|
|
17
|
-
];
|
|
18
|
-
const opts = {
|
|
19
|
-
inclusiveRangeEnds: true,
|
|
20
|
-
skipIncomingRangeSorting: true
|
|
21
|
-
};
|
|
22
|
-
function isProduction4(char) {
|
|
23
|
-
return isIndexWithin(char.codePointAt(0), priorityNameChar, opts) || isIndexWithin(char.codePointAt(0), nameStartChar, opts);
|
|
24
|
-
}
|
|
25
|
-
function isProduction4a(char) {
|
|
26
|
-
return isIndexWithin(char.codePointAt(0), priorityNameChar, opts) || isIndexWithin(char.codePointAt(0), nameChar, opts);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export { isProduction4, isProduction4a, isProduction4 as validFirstChar, isProduction4a as validSecondCharOnwards };
|
|
10
|
+
import{isIndexWithin as o}from"ranges-is-index-within";var a=[[58,58],[65,90],[95,95],[192,214],[216,246],[248,767],[880,893],[895,8191],[8204,8205],[8304,8591],[11264,12271],[12289,55295],[63744,64975],[65008,65533],[65536,983039]],s=[[45,45],[46,46],[48,57],[58,58],[65,90],[95,95],[183,183],[192,214],[216,246],[248,767],[768,879],[880,893],[895,8191],[8204,8205],[8255,8256],[8304,8591],[11264,12271],[12289,55295],[63744,64975],[65008,65533],[65536,983039]],t=[[97,122]],e={inclusiveRangeEnds:!0,skipIncomingRangeSorting:!0};function i(n){return o(n.codePointAt(0),t,e)||o(n.codePointAt(0),a,e)}function c(n){return o(n.codePointAt(0),t,e)||o(n.codePointAt(0),s,e)}export{i as isProduction4,c as isProduction4a,i as validFirstChar,c as validSecondCharOnwards};
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @name charcode-is-valid-xml-name-character
|
|
3
3
|
* @fileoverview Does a given character belong to XML spec's "Production 4 OR 4a" type (is acceptable for XML element's name)
|
|
4
|
-
* @version 2.0.
|
|
4
|
+
* @version 2.0.10
|
|
5
5
|
* @author Roy Revelt, Codsen Ltd
|
|
6
6
|
* @license MIT
|
|
7
7
|
* {@link https://codsen.com/os/charcode-is-valid-xml-name-character/}
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
var charcodeIsValidXmlNameCharacter=(()=>{var i=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames,d=Object.getOwnPropertySymbols;var c=Object.prototype.hasOwnProperty,b=Object.prototype.propertyIsEnumerable;var g=(n,e,r)=>e in n?i(n,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):n[e]=r,u=(n,e)=>{for(var r in e||(e={}))c.call(e,r)&&g(n,r,e[r]);if(d)for(var r of d(e))b.call(e,r)&&g(n,r,e[r]);return n};var f=n=>i(n,"__esModule",{value:!0});var R=(n,e)=>{for(var r in e)i(n,r,{get:e[r],enumerable:!0})},h=(n,e,r,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of p(e))!c.call(n,a)&&(r||a!=="default")&&i(n,a,{get:()=>e[a],enumerable:!(t=l(e,a))||t.enumerable});return n};var v=(n=>(e,r)=>n&&n.get(e)||(r=h(f({}),e,1),n&&n.set(e,r),r))(typeof WeakMap!="undefined"?new WeakMap:0);var w={};R(w,{isProduction4:()=>A,isProduction4a:()=>P,validFirstChar:()=>A,validSecondCharOnwards:()=>P});var I={inclusiveRangeEnds:!1,returnMatchedRangeInsteadOfTrue:!1};function o(n,e,r){let t=u(u({},I),r);if(!Number.isInteger(n))throw new Error(`ranges-is-index-within: [THROW_ID_01] the first input argument should be string index, a natural number (or zero). It was given as ${n} (type ${typeof n})`);return Array.isArray(e)?t.returnMatchedRangeInsteadOfTrue?e.find(a=>t.inclusiveRangeEnds?n>=a[0]&&n<=a[1]:n>a[0]&&n<a[1])||!1:e.some(a=>t.inclusiveRangeEnds?n>=a[0]&&n<=a[1]:n>a[0]&&n<a[1]):!1}var y=[[58,58],[65,90],[95,95],[192,214],[216,246],[248,767],[880,893],[895,8191],[8204,8205],[8304,8591],[11264,12271],[12289,55295],[63744,64975],[65008,65533],[65536,983039]],x=[[45,45],[46,46],[48,57],[58,58],[65,90],[95,95],[183,183],[192,214],[216,246],[248,767],[768,879],[880,893],[895,8191],[8204,8205],[8255,8256],[8304,8591],[11264,12271],[12289,55295],[63744,64975],[65008,65533],[65536,983039]],m=[[97,122]],s={inclusiveRangeEnds:!0,skipIncomingRangeSorting:!0};function A(n){return o(n.codePointAt(0),m,s)||o(n.codePointAt(0),y,s)}function P(n){return o(n.codePointAt(0),m,s)||o(n.codePointAt(0),x,s)}return v(w);})();
|
|
11
11
|
/**
|
|
12
12
|
* @name ranges-is-index-within
|
|
13
13
|
* @fileoverview Checks if index is within any of the given string index ranges
|
|
14
|
-
* @version 3.0.
|
|
14
|
+
* @version 3.0.10
|
|
15
15
|
* @author Roy Revelt, Codsen Ltd
|
|
16
16
|
* @license MIT
|
|
17
17
|
* {@link https://codsen.com/os/ranges-is-index-within/}
|
|
18
|
-
*/
|
|
18
|
+
*/
|
package/examples/_quickTake.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "charcode-is-valid-xml-name-character",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.10",
|
|
4
4
|
"description": "Does a given character belong to XML spec's \"Production 4 OR 4a\" type (is acceptable for XML element's name)",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"4",
|
|
@@ -38,93 +38,37 @@
|
|
|
38
38
|
},
|
|
39
39
|
"types": "types/index.d.ts",
|
|
40
40
|
"scripts": {
|
|
41
|
-
"build": "
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"prettier": "../../node_modules/prettier/bin-prettier.js '*.{js,css,scss,vue,md,ts}' --write --loglevel silent",
|
|
54
|
-
"republish": "npm publish || :",
|
|
55
|
-
"tap": "tap",
|
|
56
|
-
"pretest": "npm run build",
|
|
57
|
-
"test": "npm run lint && npm run unittest && npm run test:examples && npm run clean_cov && npm run format",
|
|
58
|
-
"test:examples": "../../scripts/test-examples.js && npm run lect && npm run prettier",
|
|
59
|
-
"tsc": "tsc",
|
|
60
|
-
"unittest": "tap --no-only --output-file=testStats.md --reporter=terse && tsc -p tsconfig.json --noEmit && npm run clean_cov && npm run perf"
|
|
41
|
+
"build": "node '../../ops/scripts/esbuild.js' && yarn run dts",
|
|
42
|
+
"dev": "DEV=true node '../../ops/scripts/esbuild.js' && yarn run dts",
|
|
43
|
+
"dts": "rollup -c",
|
|
44
|
+
"examples": "node '../../ops/scripts/run-examples.js'",
|
|
45
|
+
"lect": "node '../../ops/lect/lect.js'",
|
|
46
|
+
"letspublish": "yarn publish || :",
|
|
47
|
+
"lint": "eslint . --fix",
|
|
48
|
+
"perf": "node perf/check.js",
|
|
49
|
+
"prepare": "echo 'ready'",
|
|
50
|
+
"pretest": "yarn run lect && yarn run build",
|
|
51
|
+
"test": "c8 yarn run unit && yarn run examples && yarn run lint",
|
|
52
|
+
"unit": "uvu test"
|
|
61
53
|
},
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
"--no-warnings",
|
|
70
|
-
"--experimental-loader",
|
|
71
|
-
"@istanbuljs/esm-loader-hook"
|
|
54
|
+
"engines": {
|
|
55
|
+
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
|
|
56
|
+
},
|
|
57
|
+
"c8": {
|
|
58
|
+
"check-coverage": true,
|
|
59
|
+
"exclude": [
|
|
60
|
+
"**/test/**/*.*"
|
|
72
61
|
],
|
|
73
|
-
"
|
|
62
|
+
"lines": 100
|
|
74
63
|
},
|
|
75
64
|
"lect": {
|
|
76
65
|
"licence": {
|
|
77
66
|
"extras": [
|
|
78
67
|
""
|
|
79
68
|
]
|
|
80
|
-
},
|
|
81
|
-
"req": "{ isProduction4, isProduction4a, validFirstChar, validSecondCharOnwards }",
|
|
82
|
-
"various": {
|
|
83
|
-
"devDependencies": []
|
|
84
69
|
}
|
|
85
70
|
},
|
|
86
71
|
"dependencies": {
|
|
87
|
-
"
|
|
88
|
-
"ranges-is-index-within": "^3.0.4"
|
|
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-node-resolve": "^13.0.6",
|
|
107
|
-
"@rollup/plugin-strip": "^2.1.0",
|
|
108
|
-
"@rollup/plugin-typescript": "^8.3.0",
|
|
109
|
-
"@types/node": "^16.11.6",
|
|
110
|
-
"@types/tap": "^15.0.5",
|
|
111
|
-
"@typescript-eslint/eslint-plugin": "^5.3.0",
|
|
112
|
-
"@typescript-eslint/parser": "^5.3.0",
|
|
113
|
-
"core-js": "^3.19.1",
|
|
114
|
-
"cross-env": "^7.0.3",
|
|
115
|
-
"eslint": "^8.1.0",
|
|
116
|
-
"lect": "^0.18.4",
|
|
117
|
-
"rollup": "^2.59.0",
|
|
118
|
-
"rollup-plugin-ascii": "^0.0.3",
|
|
119
|
-
"rollup-plugin-banner": "^0.2.1",
|
|
120
|
-
"rollup-plugin-cleanup": "^3.2.1",
|
|
121
|
-
"rollup-plugin-dts": "^4.0.0",
|
|
122
|
-
"rollup-plugin-terser": "^7.0.2",
|
|
123
|
-
"tap": "^15.0.10",
|
|
124
|
-
"tslib": "^2.3.1",
|
|
125
|
-
"typescript": "^4.4.4"
|
|
126
|
-
},
|
|
127
|
-
"engines": {
|
|
128
|
-
"node": ">=12"
|
|
72
|
+
"ranges-is-index-within": "^3.0.10"
|
|
129
73
|
}
|
|
130
74
|
}
|
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 {\n isProduction4,\n isProduction4a,\n validFirstChar,\n validSecondCharOnwards,\n} from \"charcode-is-valid-xml-name-character\";\n\n// Spec: https://www.w3.org/TR/REC-xml/#NT-NameStartChar\n\nassert.equal(isProduction4(\"Z\"), true);\nassert.equal(isProduction4(\"?\"), false);\n\nassert.equal(isProduction4a(\"?\"), false);\nassert.equal(isProduction4a(\"-\"), true);\n\nassert.equal(validFirstChar(\"a\"), true);\nassert.equal(validFirstChar(\"1\"), false);\n\nassert.equal(validSecondCharOnwards(\"a\"), true);\nassert.equal(validSecondCharOnwards(\"?\"), false);"}}
|