@markuplint/types 3.0.0-dev.24 → 3.0.0-dev.290
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 +63 -61
- package/lib/check-multi-types.d.ts +2 -2
- package/lib/check-multi-types.js +9 -13
- package/lib/check.d.ts +7 -6
- package/lib/check.js +20 -30
- package/lib/css-syntax.d.ts +1 -1
- package/lib/css-syntax.js +60 -63
- package/lib/debug.js +2 -6
- package/lib/defs.d.ts +1 -1
- package/lib/defs.js +163 -91
- package/lib/enum.d.ts +4 -3
- package/lib/enum.js +7 -12
- package/lib/get-candidate.d.ts +1 -1
- package/lib/get-candidate.js +3 -8
- package/lib/index.d.ts +3 -3
- package/lib/index.js +3 -6
- package/lib/keyword-type.d.ts +2 -2
- package/lib/keyword-type.js +17 -21
- package/lib/list.d.ts +4 -3
- package/lib/list.js +9 -13
- package/lib/match-result.d.ts +4 -4
- package/lib/match-result.js +6 -12
- package/lib/number.d.ts +3 -3
- package/lib/number.js +11 -15
- package/lib/primitive/index.d.ts +7 -7
- package/lib/primitive/index.js +7 -17
- package/lib/primitive/is-float.js +1 -5
- package/lib/primitive/is-int.js +1 -5
- package/lib/primitive/is-non-zero-uint.js +1 -5
- package/lib/primitive/is-quantity.d.ts +1 -1
- package/lib/primitive/is-quantity.js +9 -13
- package/lib/primitive/is-uint.d.ts +1 -1
- package/lib/primitive/is-uint.js +1 -5
- package/lib/primitive/range.js +1 -5
- package/lib/primitive/split-unit.js +3 -7
- package/lib/rfc/is-bcp-47.d.ts +1 -1
- package/lib/rfc/is-bcp-47.js +3 -7
- package/lib/token/index.d.ts +2 -2
- package/lib/token/index.js +2 -7
- package/lib/token/token-collection.d.ts +13 -13
- package/lib/token/token-collection.js +55 -50
- package/lib/token/token.d.ts +11 -10
- package/lib/token/token.js +16 -24
- package/lib/token/types.d.ts +3 -0
- package/lib/types.d.ts +47 -46
- package/lib/types.js +1 -2
- package/lib/types.schema.d.ts +2 -2
- package/lib/types.schema.js +1 -3
- package/lib/w3c/check-serialized-permissions-policy.d.ts +1 -1
- package/lib/w3c/check-serialized-permissions-policy.js +16 -20
- package/lib/whatwg/check-autocomplete.d.ts +1 -1
- package/lib/whatwg/check-autocomplete.js +28 -32
- package/lib/whatwg/check-datetime/date-string.d.ts +1 -1
- package/lib/whatwg/check-datetime/date-string.js +9 -13
- package/lib/whatwg/check-datetime/datetime-tokens.d.ts +1 -1
- package/lib/whatwg/check-datetime/datetime-tokens.js +43 -46
- package/lib/whatwg/check-datetime/duration-string.d.ts +1 -1
- package/lib/whatwg/check-datetime/duration-string.js +48 -44
- package/lib/whatwg/check-datetime/global-date-and-time-string.d.ts +1 -1
- package/lib/whatwg/check-datetime/global-date-and-time-string.js +17 -21
- package/lib/whatwg/check-datetime/index.d.ts +1 -1
- package/lib/whatwg/check-datetime/index.js +25 -29
- package/lib/whatwg/check-datetime/local-date-and-time-string.d.ts +1 -1
- package/lib/whatwg/check-datetime/local-date-and-time-string.js +25 -26
- package/lib/whatwg/check-datetime/month-string.d.ts +1 -1
- package/lib/whatwg/check-datetime/month-string.js +9 -13
- package/lib/whatwg/check-datetime/time-string.d.ts +1 -1
- package/lib/whatwg/check-datetime/time-string.js +9 -13
- package/lib/whatwg/check-datetime/time-zone-offset-string.d.ts +3 -3
- package/lib/whatwg/check-datetime/time-zone-offset-string.js +16 -21
- package/lib/whatwg/check-datetime/week-string.d.ts +1 -1
- package/lib/whatwg/check-datetime/week-string.js +9 -13
- package/lib/whatwg/check-datetime/year-string.d.ts +1 -1
- package/lib/whatwg/check-datetime/year-string.js +9 -13
- package/lib/whatwg/check-datetime/yearless-date-string.d.ts +1 -1
- package/lib/whatwg/check-datetime/yearless-date-string.js +9 -13
- package/lib/whatwg/check-mime-type.d.ts +1 -1
- package/lib/whatwg/check-mime-type.js +12 -18
- package/lib/whatwg/is-abs-url.d.ts +1 -1
- package/lib/whatwg/is-abs-url.js +1 -5
- package/lib/whatwg/is-browser-context-name.d.ts +3 -1
- package/lib/whatwg/is-browser-context-name.js +3 -5
- package/lib/whatwg/is-custom-element-name.d.ts +1 -1
- package/lib/whatwg/is-custom-element-name.js +1 -5
- package/lib/whatwg/is-itemprop-name.d.ts +1 -1
- package/lib/whatwg/is-itemprop-name.js +2 -6
- package/lib/whatwg/is-navigable-target-name.d.ts +11 -0
- package/lib/whatwg/is-navigable-target-name.js +20 -0
- package/package.json +19 -13
- package/types.schema.json +314 -311
- package/gen/specific-schema.json +0 -98
- package/gen/types.ts +0 -66
- package/lib/check.spec.js +0 -76
- package/lib/css-syntax.spec.d.ts +0 -1
- package/lib/css-syntax.spec.js +0 -157
- package/lib/list.spec.d.ts +0 -1
- package/lib/list.spec.js +0 -129
- package/lib/primitive/index.spec.d.ts +0 -1
- package/lib/primitive/index.spec.js +0 -62
- package/lib/rfc/is-bcp-47.spec.d.ts +0 -1
- package/lib/rfc/is-bcp-47.spec.js +0 -19
- package/lib/token/token-collection.spec.d.ts +0 -1
- package/lib/token/token-collection.spec.js +0 -144
- package/lib/w3c/check-serialized-permissions-policy.spec.d.ts +0 -1
- package/lib/w3c/check-serialized-permissions-policy.spec.js +0 -34
- package/lib/whatwg/check-autocomplete.spec.d.ts +0 -1
- package/lib/whatwg/check-autocomplete.spec.js +0 -379
- package/lib/whatwg/check-datetime/index.spec.d.ts +0 -1
- package/lib/whatwg/check-datetime/index.spec.js +0 -318
- package/lib/whatwg/check-mime-type.spec.d.ts +0 -1
- package/lib/whatwg/check-mime-type.spec.js +0 -58
- package/lib/whatwg/is-abs-url.spec.d.ts +0 -1
- package/lib/whatwg/is-abs-url.spec.js +0 -8
- package/patches/css-tree+2.3.1.patch +0 -23
- package/src/check-multi-types.ts +0 -35
- package/src/check.spec.ts +0 -83
- package/src/check.ts +0 -48
- package/src/css-syntax.spec.ts +0 -167
- package/src/css-syntax.ts +0 -188
- package/src/debug.ts +0 -3
- package/src/defs.ts +0 -811
- package/src/enum.ts +0 -25
- package/src/get-candidate.ts +0 -24
- package/src/index.ts +0 -3
- package/src/keyword-type.ts +0 -64
- package/src/list.spec.ts +0 -133
- package/src/list.ts +0 -34
- package/src/match-result.ts +0 -49
- package/src/number.ts +0 -46
- package/src/primitive/index.spec.ts +0 -65
- package/src/primitive/index.ts +0 -7
- package/src/primitive/is-float.ts +0 -8
- package/src/primitive/is-int.ts +0 -8
- package/src/primitive/is-non-zero-uint.ts +0 -8
- package/src/primitive/is-quantity.ts +0 -38
- package/src/primitive/is-uint.ts +0 -15
- package/src/primitive/range.ts +0 -14
- package/src/primitive/split-unit.ts +0 -20
- package/src/rfc/is-bcp-47.spec.ts +0 -23
- package/src/rfc/is-bcp-47.ts +0 -13
- package/src/token/index.ts +0 -2
- package/src/token/token-collection.spec.ts +0 -147
- package/src/token/token-collection.ts +0 -444
- package/src/token/token.ts +0 -144
- package/src/types.schema.ts +0 -1113
- package/src/types.ts +0 -118
- package/src/w3c/check-serialized-permissions-policy.spec.ts +0 -38
- package/src/w3c/check-serialized-permissions-policy.ts +0 -303
- package/src/whatwg/check-autocomplete.spec.ts +0 -387
- package/src/whatwg/check-autocomplete.ts +0 -380
- package/src/whatwg/check-datetime/date-string.ts +0 -44
- package/src/whatwg/check-datetime/datetime-tokens.ts +0 -600
- package/src/whatwg/check-datetime/duration-string.ts +0 -399
- package/src/whatwg/check-datetime/global-date-and-time-string.ts +0 -96
- package/src/whatwg/check-datetime/index.spec.ts +0 -333
- package/src/whatwg/check-datetime/index.ts +0 -36
- package/src/whatwg/check-datetime/local-date-and-time-string.ts +0 -163
- package/src/whatwg/check-datetime/month-string.ts +0 -31
- package/src/whatwg/check-datetime/time-string.ts +0 -49
- package/src/whatwg/check-datetime/time-zone-offset-string.ts +0 -93
- package/src/whatwg/check-datetime/week-string.ts +0 -41
- package/src/whatwg/check-datetime/year-string.ts +0 -26
- package/src/whatwg/check-datetime/yearless-date-string.ts +0 -38
- package/src/whatwg/check-mime-type.spec.ts +0 -59
- package/src/whatwg/check-mime-type.ts +0 -46
- package/src/whatwg/is-abs-url.spec.ts +0 -8
- package/src/whatwg/is-abs-url.ts +0 -31
- package/src/whatwg/is-browser-context-name.ts +0 -16
- package/src/whatwg/is-custom-element-name.ts +0 -76
- package/src/whatwg/is-itemprop-name.ts +0 -17
- package/tsconfig.test.json +0 -3
- package/tsconfig.tsbuildinfo +0 -1
- /package/lib/{check.spec.d.ts → token/types.js} +0 -0
package/gen/specific-schema.json
DELETED
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
-
"definitions": {
|
|
4
|
-
"list": {
|
|
5
|
-
"description": "- [Space-separated tokens](https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#space-separated-tokens)\n- [Comma-separated tokens](https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#comma-separated-tokens)",
|
|
6
|
-
"type": "object",
|
|
7
|
-
"additionalProperties": false,
|
|
8
|
-
"required": ["token", "separator"],
|
|
9
|
-
"properties": {
|
|
10
|
-
"token": {
|
|
11
|
-
"oneOf": [
|
|
12
|
-
{
|
|
13
|
-
"$ref": "#/definitions/extended-type"
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
"$ref": "#/definitions/enum"
|
|
17
|
-
}
|
|
18
|
-
]
|
|
19
|
-
},
|
|
20
|
-
"disallowToSurroundBySpaces": { "type": "boolean" },
|
|
21
|
-
"allowEmpty": { "type": "boolean" },
|
|
22
|
-
"ordered": { "type": "boolean" },
|
|
23
|
-
"unique": { "type": "boolean" },
|
|
24
|
-
"caseInsensitive": { "type": "boolean" },
|
|
25
|
-
"number": {
|
|
26
|
-
"oneOf": [
|
|
27
|
-
{
|
|
28
|
-
"type": "string",
|
|
29
|
-
"enum": ["zeroOrMore", "oneOrMore"]
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
"type": "object",
|
|
33
|
-
"additionalProperties": false,
|
|
34
|
-
"required": ["min", "max"],
|
|
35
|
-
"properties": {
|
|
36
|
-
"min": { "type": "number" },
|
|
37
|
-
"max": { "type": "number" }
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
]
|
|
41
|
-
},
|
|
42
|
-
"separator": {
|
|
43
|
-
"type": "string",
|
|
44
|
-
"enum": ["space", "comma"]
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
},
|
|
48
|
-
"enum": {
|
|
49
|
-
"description": "[Enumerated attributes](https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#enumerated-attribute)",
|
|
50
|
-
"type": "object",
|
|
51
|
-
"additionalProperties": false,
|
|
52
|
-
"required": ["enum"],
|
|
53
|
-
"properties": {
|
|
54
|
-
"enum": {
|
|
55
|
-
"type": "array",
|
|
56
|
-
"minItems": 1,
|
|
57
|
-
"uniqueItems": true,
|
|
58
|
-
"items": {
|
|
59
|
-
"type": "string"
|
|
60
|
-
}
|
|
61
|
-
},
|
|
62
|
-
"disallowToSurroundBySpaces": { "type": "boolean" },
|
|
63
|
-
"caseInsensitive": { "type": "boolean" },
|
|
64
|
-
"invalidValueDefault": { "type": "string" },
|
|
65
|
-
"missingValueDefault": { "type": "string" },
|
|
66
|
-
"sameStates": {
|
|
67
|
-
"type": "object",
|
|
68
|
-
"additionalProperties": true,
|
|
69
|
-
"patternProperties": {
|
|
70
|
-
".*": {
|
|
71
|
-
"type": "array",
|
|
72
|
-
"minItems": 1,
|
|
73
|
-
"uniqueItems": true,
|
|
74
|
-
"items": { "type": "string" }
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
},
|
|
80
|
-
"number": {
|
|
81
|
-
"description": "[Numbers](https://html.spec.whatwg.org/dev/common-microsyntaxes.html#numbers)",
|
|
82
|
-
"type": "object",
|
|
83
|
-
"required": ["type"],
|
|
84
|
-
"additionalProperties": false,
|
|
85
|
-
"properties": {
|
|
86
|
-
"type": {
|
|
87
|
-
"type": "string",
|
|
88
|
-
"enum": ["float", "integer"]
|
|
89
|
-
},
|
|
90
|
-
"gt": { "type": "number" },
|
|
91
|
-
"gte": { "type": "number" },
|
|
92
|
-
"lt": { "type": "number" },
|
|
93
|
-
"lte": { "type": "number" },
|
|
94
|
-
"clampable": { "type": "boolean" }
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}
|
package/gen/types.ts
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import fs from 'fs';
|
|
2
|
-
import path from 'path';
|
|
3
|
-
|
|
4
|
-
// @ts-ignore
|
|
5
|
-
import { lexer } from 'css-tree';
|
|
6
|
-
|
|
7
|
-
import { types as extendedTypes, tokenizers } from '../src/defs';
|
|
8
|
-
|
|
9
|
-
const props = Object.keys(lexer.properties).map(p => `<'${p}'>`);
|
|
10
|
-
const types = Object.keys(lexer.types).map(t => `<${t}>`);
|
|
11
|
-
|
|
12
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
13
|
-
const specific = require('./specific-schema.json');
|
|
14
|
-
|
|
15
|
-
fs.writeFileSync(
|
|
16
|
-
path.resolve(__dirname, '..', 'types.schema.json'),
|
|
17
|
-
JSON.stringify({
|
|
18
|
-
$schema: 'http://json-schema.org/draft-07/schema#',
|
|
19
|
-
type: 'object',
|
|
20
|
-
additionalProperties: false,
|
|
21
|
-
definitions: {
|
|
22
|
-
'css-syntax': {
|
|
23
|
-
type: 'string',
|
|
24
|
-
enum: [...Array.from(new Set([...props, ...types])), ...Object.keys(tokenizers).map(t => `<${t}>`)],
|
|
25
|
-
},
|
|
26
|
-
'extended-type': {
|
|
27
|
-
type: 'string',
|
|
28
|
-
enum: Object.keys(extendedTypes),
|
|
29
|
-
},
|
|
30
|
-
'html-attr-requirement': {
|
|
31
|
-
type: 'string',
|
|
32
|
-
enum: ['Boolean'],
|
|
33
|
-
},
|
|
34
|
-
'keyword-defined-type': {
|
|
35
|
-
...oneOf(
|
|
36
|
-
//
|
|
37
|
-
'css-syntax',
|
|
38
|
-
'extended-type',
|
|
39
|
-
'html-attr-requirement',
|
|
40
|
-
),
|
|
41
|
-
},
|
|
42
|
-
...specific.definitions,
|
|
43
|
-
type: {
|
|
44
|
-
...oneOf(
|
|
45
|
-
//
|
|
46
|
-
'keyword-defined-type',
|
|
47
|
-
...Object.keys(specific.definitions),
|
|
48
|
-
),
|
|
49
|
-
},
|
|
50
|
-
},
|
|
51
|
-
properties: {
|
|
52
|
-
type: {
|
|
53
|
-
$ref: '#/definitions/type',
|
|
54
|
-
},
|
|
55
|
-
},
|
|
56
|
-
}),
|
|
57
|
-
{ encoding: 'utf-8' },
|
|
58
|
-
);
|
|
59
|
-
|
|
60
|
-
function oneOf(...keys: string[]) {
|
|
61
|
-
return {
|
|
62
|
-
oneOf: keys.map(key => ({
|
|
63
|
-
$ref: `#/definitions/${key}`,
|
|
64
|
-
})),
|
|
65
|
-
};
|
|
66
|
-
}
|
package/lib/check.spec.js
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const check_1 = require("./check");
|
|
4
|
-
test('Any', () => {
|
|
5
|
-
expect((0, check_1.check)('', 'Any').matched).toBe(true);
|
|
6
|
-
expect((0, check_1.check)(' ', 'Any').matched).toBe(true);
|
|
7
|
-
expect((0, check_1.check)('a', 'Any').matched).toBe(true);
|
|
8
|
-
});
|
|
9
|
-
test('NoEmptyAny', () => {
|
|
10
|
-
expect((0, check_1.check)('', 'NoEmptyAny').matched).toBe(false);
|
|
11
|
-
expect((0, check_1.check)(' ', 'NoEmptyAny').matched).toBe(true);
|
|
12
|
-
expect((0, check_1.check)('a', 'NoEmptyAny').matched).toBe(true);
|
|
13
|
-
});
|
|
14
|
-
test('OneLineAny', () => {
|
|
15
|
-
expect((0, check_1.check)('', 'OneLineAny').matched).toBe(true);
|
|
16
|
-
expect((0, check_1.check)(' ', 'OneLineAny').matched).toBe(true);
|
|
17
|
-
expect((0, check_1.check)('a', 'OneLineAny').matched).toBe(true);
|
|
18
|
-
expect((0, check_1.check)('a ', 'OneLineAny').matched).toBe(true);
|
|
19
|
-
expect((0, check_1.check)('a b', 'OneLineAny').matched).toBe(true);
|
|
20
|
-
expect((0, check_1.check)('a\n', 'OneLineAny').matched).toBe(false);
|
|
21
|
-
expect((0, check_1.check)('a\nb', 'OneLineAny').matched).toBe(false);
|
|
22
|
-
expect((0, check_1.check)('a\r\nb', 'OneLineAny').matched).toBe(false);
|
|
23
|
-
expect((0, check_1.check)('a\rb', 'OneLineAny').matched).toBe(false);
|
|
24
|
-
});
|
|
25
|
-
test('Pattern', () => {
|
|
26
|
-
expect((0, check_1.check)('.*', 'Pattern').matched).toBe(true);
|
|
27
|
-
expect((0, check_1.check)('[a-z]+', 'Pattern').matched).toBe(true);
|
|
28
|
-
expect((0, check_1.check)(']//[()?!+*', 'Pattern').matched).toBe(false);
|
|
29
|
-
});
|
|
30
|
-
test('BCP47', () => {
|
|
31
|
-
expect((0, check_1.check)('en', 'BCP47').matched).toBe(true);
|
|
32
|
-
expect((0, check_1.check)('en-US', 'BCP47').matched).toBe(true);
|
|
33
|
-
expect((0, check_1.check)('ja', 'BCP47').matched).toBe(true);
|
|
34
|
-
expect((0, check_1.check)(' ja ', 'BCP47').matched).toBe(false);
|
|
35
|
-
expect((0, check_1.check)('', 'BCP47').matched).toBe(false);
|
|
36
|
-
expect((0, check_1.check)('zh/cn', 'BCP47').matched).toBe(false);
|
|
37
|
-
});
|
|
38
|
-
test('Srcset', () => {
|
|
39
|
-
expect((0, check_1.check)('a/bb/ccc/dddd', 'Srcset').matched).toBe(true);
|
|
40
|
-
expect((0, check_1.check)('a/bb/ccc/dddd 200w', 'Srcset').matched).toBe(true);
|
|
41
|
-
expect((0, check_1.check)('a/bb/ccc/dddd 200w, b/cc/ddd/eeee 1.5x', 'Srcset').matched).toBe(true);
|
|
42
|
-
expect((0, check_1.check)('a/bb/ccc/dddd 200w, b/cc/ddd/eeee 1.5a', 'Srcset').matched).toBe(false);
|
|
43
|
-
});
|
|
44
|
-
test('IconSize', () => {
|
|
45
|
-
expect((0, check_1.check)('any', 'IconSize').matched).toBe(true);
|
|
46
|
-
expect((0, check_1.check)('Any', 'IconSize').matched).toBe(true);
|
|
47
|
-
expect((0, check_1.check)('10x10', 'IconSize').matched).toBe(true);
|
|
48
|
-
expect((0, check_1.check)('1x1', 'IconSize').matched).toBe(true);
|
|
49
|
-
expect((0, check_1.check)('1x0', 'IconSize').matched).toBe(false);
|
|
50
|
-
expect((0, check_1.check)('0x1', 'IconSize').matched).toBe(false);
|
|
51
|
-
expect((0, check_1.check)('0x0', 'IconSize').matched).toBe(false);
|
|
52
|
-
expect((0, check_1.check)('', 'IconSize').matched).toBe(false);
|
|
53
|
-
expect((0, check_1.check)(' ', 'IconSize').matched).toBe(false);
|
|
54
|
-
expect((0, check_1.check)('1', 'IconSize').matched).toBe(false);
|
|
55
|
-
expect((0, check_1.check)('1x', 'IconSize').matched).toBe(false);
|
|
56
|
-
expect((0, check_1.check)('x1', 'IconSize').matched).toBe(false);
|
|
57
|
-
});
|
|
58
|
-
test('Number', () => {
|
|
59
|
-
expect((0, check_1.check)('10', { type: 'integer', gt: 0 }).matched).toBe(true);
|
|
60
|
-
expect((0, check_1.check)('0', { type: 'integer', gt: 0 }).matched).toBe(false);
|
|
61
|
-
expect((0, check_1.check)('0', { type: 'integer', gte: 0 }).matched).toBe(true);
|
|
62
|
-
expect((0, check_1.check)('9', { type: 'integer', lt: 10 }).matched).toBe(true);
|
|
63
|
-
expect((0, check_1.check)('10', { type: 'integer', lt: 10 }).matched).toBe(false);
|
|
64
|
-
});
|
|
65
|
-
test('Non-exist types', () => {
|
|
66
|
-
// @ts-ignore
|
|
67
|
-
expect((0, check_1.check)('abc', 'String').matched).toBe(true);
|
|
68
|
-
// @ts-ignore
|
|
69
|
-
expect((0, check_1.check)('abc', 'FooBar').matched).toBe(true);
|
|
70
|
-
// @ts-ignore
|
|
71
|
-
expect((0, check_1.check)('abc', ' ').matched).toBe(true);
|
|
72
|
-
// @ts-ignore
|
|
73
|
-
expect((0, check_1.check)('abc', '\n').matched).toBe(true);
|
|
74
|
-
// @ts-ignore
|
|
75
|
-
expect((0, check_1.check)('abc', '').matched).toBe(true);
|
|
76
|
-
});
|
package/lib/css-syntax.spec.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/lib/css-syntax.spec.js
DELETED
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const css_syntax_1 = require("./css-syntax");
|
|
4
|
-
test('CSS Standard', () => {
|
|
5
|
-
expect((0, css_syntax_1.cssSyntaxMatch)('10px', '<length>').matched).toBe(true);
|
|
6
|
-
expect((0, css_syntax_1.cssSyntaxMatch)('one-pixel', '<length>').matched).toBe(false);
|
|
7
|
-
expect((0, css_syntax_1.cssSyntaxMatch)('(prefers-color-scheme: dark)', '<media-query-list>').matched).toBe(true);
|
|
8
|
-
});
|
|
9
|
-
test('Extends', () => {
|
|
10
|
-
const sourceSizeList = {
|
|
11
|
-
ref: 'https://html.spec.whatwg.org/multipage/images.html#sizes-attributes',
|
|
12
|
-
syntax: {
|
|
13
|
-
apply: '<source-size-list>',
|
|
14
|
-
def: {
|
|
15
|
-
'source-size-list': '[ <source-size># , ]? <source-size-value>',
|
|
16
|
-
'source-size': '<media-condition> <source-size-value>',
|
|
17
|
-
'source-size-value': '<length>',
|
|
18
|
-
},
|
|
19
|
-
},
|
|
20
|
-
};
|
|
21
|
-
expect((0, css_syntax_1.cssSyntaxMatch)('50vw', sourceSizeList).matched).toBe(true);
|
|
22
|
-
expect((0, css_syntax_1.cssSyntaxMatch)('(max-width: 600px) 200px, 50vw', sourceSizeList).matched).toBe(true);
|
|
23
|
-
expect((0, css_syntax_1.cssSyntaxMatch)('print 300vw', sourceSizeList).matched).toBe(false);
|
|
24
|
-
expect((0, css_syntax_1.cssSyntaxMatch)('(max-width: 600px) 200px', sourceSizeList).matched).toBe(false);
|
|
25
|
-
expect((0, css_syntax_1.cssSyntaxMatch)('(max-width: 600px) 200px', {
|
|
26
|
-
...sourceSizeList,
|
|
27
|
-
syntax: {
|
|
28
|
-
...sourceSizeList.syntax,
|
|
29
|
-
apply: '<source-size>',
|
|
30
|
-
},
|
|
31
|
-
}).matched).toBe(true);
|
|
32
|
-
const keyTimes = {
|
|
33
|
-
ref: 'https://svgwg.org/specs/animations/#KeyTimesAttribute',
|
|
34
|
-
syntax: {
|
|
35
|
-
apply: '<key-times>',
|
|
36
|
-
def: {
|
|
37
|
-
'key-times': '<number> [; <number>]* [;]?',
|
|
38
|
-
},
|
|
39
|
-
},
|
|
40
|
-
};
|
|
41
|
-
expect((0, css_syntax_1.cssSyntaxMatch)('20; 20; 30', keyTimes).matched).toBe(true);
|
|
42
|
-
expect((0, css_syntax_1.cssSyntaxMatch)('20; 20; 30;', keyTimes).matched).toBe(true);
|
|
43
|
-
expect((0, css_syntax_1.cssSyntaxMatch)('20; 20; abc;', keyTimes).matched).toBe(false);
|
|
44
|
-
expect((0, css_syntax_1.cssSyntaxMatch)('20; 20; ;', keyTimes).matched).toBe(false);
|
|
45
|
-
const SVGViewBox = {
|
|
46
|
-
ref: 'https://svgwg.org/svg2-draft/coords.html#ViewBoxAttribute',
|
|
47
|
-
syntax: {
|
|
48
|
-
apply: '<view-box>',
|
|
49
|
-
def: {
|
|
50
|
-
'view-box': '<min-x> [,]? <min-y> [,]? <width> [,]? <height>',
|
|
51
|
-
'min-x': '<number>',
|
|
52
|
-
'min-y': '<number>',
|
|
53
|
-
width: '<number>',
|
|
54
|
-
height: '<number>',
|
|
55
|
-
},
|
|
56
|
-
},
|
|
57
|
-
};
|
|
58
|
-
expect((0, css_syntax_1.cssSyntaxMatch)('0 0 30 10', SVGViewBox).matched).toBe(true);
|
|
59
|
-
expect((0, css_syntax_1.cssSyntaxMatch)('0 0, 30, 10', SVGViewBox).matched).toBe(true);
|
|
60
|
-
expect((0, css_syntax_1.cssSyntaxMatch)('0 0, 30', SVGViewBox).matched).toBe(false);
|
|
61
|
-
const percentageList = {
|
|
62
|
-
ref: 'https://developer.mozilla.org/en-US/docs/Web/SVG/Content_type#percentage',
|
|
63
|
-
syntax: {
|
|
64
|
-
apply: '<percentage-list>',
|
|
65
|
-
def: {
|
|
66
|
-
'percentage-list': '[ <number> [,]? ]* <number>',
|
|
67
|
-
},
|
|
68
|
-
},
|
|
69
|
-
};
|
|
70
|
-
expect((0, css_syntax_1.cssSyntaxMatch)('0 0 30 10', percentageList).matched).toBe(true);
|
|
71
|
-
expect((0, css_syntax_1.cssSyntaxMatch)('0, 0, 30 10', percentageList).matched).toBe(true);
|
|
72
|
-
expect((0, css_syntax_1.cssSyntaxMatch)('0', percentageList).matched).toBe(true);
|
|
73
|
-
expect((0, css_syntax_1.cssSyntaxMatch)('', percentageList).matched).toBe(false);
|
|
74
|
-
const custom = {
|
|
75
|
-
ref: 'n/a',
|
|
76
|
-
syntax: {
|
|
77
|
-
apply: '<custom>',
|
|
78
|
-
def: {
|
|
79
|
-
custom: '0 | 1 | .',
|
|
80
|
-
},
|
|
81
|
-
},
|
|
82
|
-
};
|
|
83
|
-
expect((0, css_syntax_1.cssSyntaxMatch)('0', custom).matched).toBe(true);
|
|
84
|
-
expect((0, css_syntax_1.cssSyntaxMatch)('1', custom).matched).toBe(true);
|
|
85
|
-
expect((0, css_syntax_1.cssSyntaxMatch)('.', custom).matched).toBe(true);
|
|
86
|
-
expect((0, css_syntax_1.cssSyntaxMatch)('2', custom).matched).toBe(false);
|
|
87
|
-
expect((0, css_syntax_1.cssSyntaxMatch)(':', custom).matched).toBe(false);
|
|
88
|
-
});
|
|
89
|
-
test('custom-type-checking', () => {
|
|
90
|
-
const custom = {
|
|
91
|
-
ref: 'n/a',
|
|
92
|
-
caseSensitive: true,
|
|
93
|
-
syntax: {
|
|
94
|
-
apply: '<custom>',
|
|
95
|
-
def: {
|
|
96
|
-
custom: '<custom-type>',
|
|
97
|
-
'custom-type': token => {
|
|
98
|
-
if (!token) {
|
|
99
|
-
return 0;
|
|
100
|
-
}
|
|
101
|
-
return token.value === '1' ? 1 : 0;
|
|
102
|
-
},
|
|
103
|
-
},
|
|
104
|
-
},
|
|
105
|
-
};
|
|
106
|
-
expect((0, css_syntax_1.cssSyntaxMatch)('1', custom).matched).toBe(true);
|
|
107
|
-
expect((0, css_syntax_1.cssSyntaxMatch)('0', custom).matched).toBe(false);
|
|
108
|
-
});
|
|
109
|
-
test('case-sensitive', () => {
|
|
110
|
-
const custom = {
|
|
111
|
-
ref: 'n/a',
|
|
112
|
-
caseSensitive: true,
|
|
113
|
-
syntax: {
|
|
114
|
-
apply: '<custom>',
|
|
115
|
-
def: {
|
|
116
|
-
custom: 'CaSeS [a | B | aBc]',
|
|
117
|
-
},
|
|
118
|
-
},
|
|
119
|
-
};
|
|
120
|
-
expect((0, css_syntax_1.cssSyntaxMatch)('CaSeS a', custom).matched).toBe(true);
|
|
121
|
-
expect((0, css_syntax_1.cssSyntaxMatch)('CaSeS B', custom).matched).toBe(true);
|
|
122
|
-
expect((0, css_syntax_1.cssSyntaxMatch)('CaSeS aBc', custom).matched).toBe(true);
|
|
123
|
-
expect((0, css_syntax_1.cssSyntaxMatch)('CaSeS A', custom)).toStrictEqual({
|
|
124
|
-
column: 7,
|
|
125
|
-
line: 1,
|
|
126
|
-
matched: false,
|
|
127
|
-
length: 1,
|
|
128
|
-
offset: 6,
|
|
129
|
-
partName: 'value',
|
|
130
|
-
raw: 'A',
|
|
131
|
-
reason: 'syntax-error',
|
|
132
|
-
ref: 'n/a',
|
|
133
|
-
expects: [
|
|
134
|
-
{
|
|
135
|
-
type: 'syntax',
|
|
136
|
-
value: 'CaSeS [ a | B | aBc ]',
|
|
137
|
-
},
|
|
138
|
-
],
|
|
139
|
-
});
|
|
140
|
-
expect((0, css_syntax_1.cssSyntaxMatch)('CaSeS abc', custom)).toStrictEqual({
|
|
141
|
-
column: 7,
|
|
142
|
-
line: 1,
|
|
143
|
-
matched: false,
|
|
144
|
-
length: 3,
|
|
145
|
-
offset: 6,
|
|
146
|
-
partName: 'value',
|
|
147
|
-
raw: 'abc',
|
|
148
|
-
reason: 'syntax-error',
|
|
149
|
-
ref: 'n/a',
|
|
150
|
-
expects: [
|
|
151
|
-
{
|
|
152
|
-
type: 'syntax',
|
|
153
|
-
value: 'CaSeS [ a | B | aBc ]',
|
|
154
|
-
},
|
|
155
|
-
],
|
|
156
|
-
});
|
|
157
|
-
});
|
package/lib/list.spec.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/lib/list.spec.js
DELETED
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const list_1 = require("./list");
|
|
4
|
-
test('Zero space', () => {
|
|
5
|
-
const type = { token: 'Zero', separator: 'space' };
|
|
6
|
-
expect((0, list_1.checkList)('0', type).matched).toBe(true);
|
|
7
|
-
expect((0, list_1.checkList)(' 0 ', type).matched).toBe(true);
|
|
8
|
-
expect((0, list_1.checkList)(' 0 0', type).matched).toBe(true);
|
|
9
|
-
expect((0, list_1.checkList)(' 0 0 ', type).matched).toBe(true);
|
|
10
|
-
expect((0, list_1.checkList)('0 0 0 ', type).matched).toBe(true);
|
|
11
|
-
expect((0, list_1.checkList)('0 0 0 0', type).matched).toBe(true);
|
|
12
|
-
expect((0, list_1.checkList)('0 0 0 0', type).matched).toBe(true);
|
|
13
|
-
expect((0, list_1.checkList)('1', type).matched).toBe(false);
|
|
14
|
-
expect((0, list_1.checkList)(' 1 ', type).matched).toBe(false);
|
|
15
|
-
expect((0, list_1.checkList)(' 1 0', type).matched).toBe(false);
|
|
16
|
-
expect((0, list_1.checkList)(' 1 0 ', type).matched).toBe(false);
|
|
17
|
-
expect((0, list_1.checkList)('0 1 0 ', type).matched).toBe(false);
|
|
18
|
-
expect((0, list_1.checkList)('0 1 0 0', type).matched).toBe(false);
|
|
19
|
-
expect((0, list_1.checkList)('0 1 0 0', type).matched).toBe(false);
|
|
20
|
-
});
|
|
21
|
-
test('Zero comma', () => {
|
|
22
|
-
const type = { token: 'Zero', separator: 'comma' };
|
|
23
|
-
expect((0, list_1.checkList)('0', type).matched).toBe(true);
|
|
24
|
-
expect((0, list_1.checkList)(' 0 ', type).matched).toBe(true);
|
|
25
|
-
expect((0, list_1.checkList)(' 0 0', type).matched).toBe(false);
|
|
26
|
-
expect((0, list_1.checkList)(' 0,0', type).matched).toBe(true);
|
|
27
|
-
expect((0, list_1.checkList)(' 0,,0 ', type).matched).toBe(false);
|
|
28
|
-
expect((0, list_1.checkList)('0 0 0 ', type).matched).toBe(false);
|
|
29
|
-
expect((0, list_1.checkList)(' 0,0,0,0 ', type).matched).toBe(true);
|
|
30
|
-
expect((0, list_1.checkList)('0, 0, 0 , 0', type).matched).toBe(true);
|
|
31
|
-
expect((0, list_1.checkList)('0,0,0,0,', type).matched).toBe(false);
|
|
32
|
-
expect((0, list_1.checkList)(',0,0,0,0', type).matched).toBe(false);
|
|
33
|
-
});
|
|
34
|
-
test('Zero comma (disallowToSurroundBySpaces)', () => {
|
|
35
|
-
const type = { token: 'Zero', separator: 'comma', disallowToSurroundBySpaces: true };
|
|
36
|
-
expect((0, list_1.checkList)('0', type).matched).toBe(true);
|
|
37
|
-
expect((0, list_1.checkList)(' 0 ', type).matched).toBe(false);
|
|
38
|
-
expect((0, list_1.checkList)(' 0 0', type).matched).toBe(false);
|
|
39
|
-
expect((0, list_1.checkList)(' 0,0', type).matched).toBe(false);
|
|
40
|
-
expect((0, list_1.checkList)(' 0,,0 ', type).matched).toBe(false);
|
|
41
|
-
expect((0, list_1.checkList)('0 0 0 ', type).matched).toBe(false);
|
|
42
|
-
expect((0, list_1.checkList)(' 0,0,0,0 ', type).matched).toBe(false);
|
|
43
|
-
expect((0, list_1.checkList)('0, 0, 0 , 0', type).matched).toBe(false);
|
|
44
|
-
expect((0, list_1.checkList)('0,0,0,0', type).matched).toBe(true);
|
|
45
|
-
expect((0, list_1.checkList)('0,0,0,0,', type).matched).toBe(false);
|
|
46
|
-
expect((0, list_1.checkList)(',0,0,0,0', type).matched).toBe(false);
|
|
47
|
-
});
|
|
48
|
-
test('Location of the token', () => {
|
|
49
|
-
const type = { token: 'Accept', separator: 'comma' };
|
|
50
|
-
expect((0, list_1.checkList)('x/y;a=b', type)).toStrictEqual({
|
|
51
|
-
candidate: 'x/y',
|
|
52
|
-
column: 4,
|
|
53
|
-
expects: [{ type: 'format', value: 'MIME Type with no parameters' }],
|
|
54
|
-
length: 4,
|
|
55
|
-
line: 1,
|
|
56
|
-
matched: false,
|
|
57
|
-
offset: 3,
|
|
58
|
-
raw: ';a=b',
|
|
59
|
-
reason: 'extra-token',
|
|
60
|
-
partName: 'the content of the list',
|
|
61
|
-
ref: 'https://html.spec.whatwg.org/multipage/input.html#attr-input-accept',
|
|
62
|
-
});
|
|
63
|
-
expect((0, list_1.checkList)('x/y,x/y;a=b', type)).toStrictEqual({
|
|
64
|
-
candidate: 'x/y',
|
|
65
|
-
column: 8,
|
|
66
|
-
expects: [{ type: 'format', value: 'MIME Type with no parameters' }],
|
|
67
|
-
length: 4,
|
|
68
|
-
line: 1,
|
|
69
|
-
matched: false,
|
|
70
|
-
offset: 7,
|
|
71
|
-
raw: ';a=b',
|
|
72
|
-
reason: 'extra-token',
|
|
73
|
-
partName: 'the content of the list',
|
|
74
|
-
ref: 'https://html.spec.whatwg.org/multipage/input.html#attr-input-accept',
|
|
75
|
-
});
|
|
76
|
-
expect((0, list_1.checkList)('x/y\n,\nx/y;a=b', type)).toStrictEqual({
|
|
77
|
-
candidate: 'x/y',
|
|
78
|
-
column: 4,
|
|
79
|
-
expects: [{ type: 'format', value: 'MIME Type with no parameters' }],
|
|
80
|
-
length: 4,
|
|
81
|
-
line: 3,
|
|
82
|
-
matched: false,
|
|
83
|
-
offset: 9,
|
|
84
|
-
raw: ';a=b',
|
|
85
|
-
reason: 'extra-token',
|
|
86
|
-
partName: 'the content of the list',
|
|
87
|
-
ref: 'https://html.spec.whatwg.org/multipage/input.html#attr-input-accept',
|
|
88
|
-
});
|
|
89
|
-
});
|
|
90
|
-
test('Expected comma', () => {
|
|
91
|
-
const type = { token: 'Accept', separator: 'comma' };
|
|
92
|
-
expect((0, list_1.checkList)('x/y,', type)).toStrictEqual({
|
|
93
|
-
column: 4,
|
|
94
|
-
expects: undefined,
|
|
95
|
-
length: 1,
|
|
96
|
-
line: 1,
|
|
97
|
-
matched: false,
|
|
98
|
-
offset: 3,
|
|
99
|
-
raw: ',',
|
|
100
|
-
reason: 'extra-token',
|
|
101
|
-
ref: null,
|
|
102
|
-
});
|
|
103
|
-
expect((0, list_1.checkList)('x/y,,x/y', type)).toStrictEqual({
|
|
104
|
-
column: 5,
|
|
105
|
-
expects: undefined,
|
|
106
|
-
length: 1,
|
|
107
|
-
line: 1,
|
|
108
|
-
matched: false,
|
|
109
|
-
offset: 4,
|
|
110
|
-
raw: ',',
|
|
111
|
-
reason: 'unexpected-comma',
|
|
112
|
-
ref: null,
|
|
113
|
-
});
|
|
114
|
-
});
|
|
115
|
-
test('Missing comma', () => {
|
|
116
|
-
const type = { token: 'Accept', separator: 'comma' };
|
|
117
|
-
expect((0, list_1.checkList)('a/b,x/y a/z', type)).toStrictEqual({
|
|
118
|
-
column: 9,
|
|
119
|
-
candidate: ',a/z',
|
|
120
|
-
expects: undefined,
|
|
121
|
-
length: 3,
|
|
122
|
-
line: 1,
|
|
123
|
-
matched: false,
|
|
124
|
-
offset: 8,
|
|
125
|
-
raw: 'a/z',
|
|
126
|
-
reason: 'missing-comma',
|
|
127
|
-
ref: null,
|
|
128
|
-
});
|
|
129
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const _1 = require(".");
|
|
4
|
-
test('int', () => {
|
|
5
|
-
expect((0, _1.isInt)('0')).toBe(true);
|
|
6
|
-
expect((0, _1.isInt)('1')).toBe(true);
|
|
7
|
-
expect((0, _1.isInt)('-0')).toBe(true);
|
|
8
|
-
expect((0, _1.isInt)('-1')).toBe(true);
|
|
9
|
-
expect((0, _1.isInt)('10')).toBe(true);
|
|
10
|
-
expect((0, _1.isInt)('100')).toBe(true);
|
|
11
|
-
expect((0, _1.isInt)('1.00')).toBe(false);
|
|
12
|
-
expect((0, _1.isInt)('.001')).toBe(false);
|
|
13
|
-
expect((0, _1.isInt)(' 1 ')).toBe(false);
|
|
14
|
-
expect((0, _1.isInt)('- 1')).toBe(false);
|
|
15
|
-
});
|
|
16
|
-
test('uint', () => {
|
|
17
|
-
expect((0, _1.isUint)('0')).toBe(true);
|
|
18
|
-
expect((0, _1.isUint)('1')).toBe(true);
|
|
19
|
-
expect((0, _1.isUint)('10')).toBe(true);
|
|
20
|
-
expect((0, _1.isUint)('100')).toBe(true);
|
|
21
|
-
expect((0, _1.isUint)('-0')).toBe(false);
|
|
22
|
-
expect((0, _1.isUint)('-1')).toBe(false);
|
|
23
|
-
expect((0, _1.isUint)('1.00')).toBe(false);
|
|
24
|
-
expect((0, _1.isUint)('.001')).toBe(false);
|
|
25
|
-
expect((0, _1.isUint)(' 1 ')).toBe(false);
|
|
26
|
-
expect((0, _1.isUint)('- 1')).toBe(false);
|
|
27
|
-
});
|
|
28
|
-
test('float', () => {
|
|
29
|
-
expect((0, _1.isFloat)('0')).toBe(true);
|
|
30
|
-
expect((0, _1.isFloat)('1')).toBe(true);
|
|
31
|
-
expect((0, _1.isFloat)('10')).toBe(true);
|
|
32
|
-
expect((0, _1.isFloat)('100')).toBe(true);
|
|
33
|
-
expect((0, _1.isFloat)('-0')).toBe(true);
|
|
34
|
-
expect((0, _1.isFloat)('-1')).toBe(true);
|
|
35
|
-
expect((0, _1.isFloat)('1.00')).toBe(true);
|
|
36
|
-
expect((0, _1.isFloat)('.001')).toBe(true);
|
|
37
|
-
expect((0, _1.isFloat)(' 1 ')).toBe(false);
|
|
38
|
-
expect((0, _1.isFloat)('- 1')).toBe(false);
|
|
39
|
-
});
|
|
40
|
-
test('nonZeroUint', () => {
|
|
41
|
-
expect((0, _1.isNonZeroUint)('0')).toBe(false);
|
|
42
|
-
expect((0, _1.isNonZeroUint)('1')).toBe(true);
|
|
43
|
-
expect((0, _1.isNonZeroUint)('10')).toBe(true);
|
|
44
|
-
expect((0, _1.isNonZeroUint)('100')).toBe(true);
|
|
45
|
-
expect((0, _1.isNonZeroUint)('-0')).toBe(false);
|
|
46
|
-
expect((0, _1.isNonZeroUint)('-1')).toBe(false);
|
|
47
|
-
expect((0, _1.isNonZeroUint)('1.00')).toBe(false);
|
|
48
|
-
expect((0, _1.isNonZeroUint)('.001')).toBe(false);
|
|
49
|
-
expect((0, _1.isNonZeroUint)(' 1 ')).toBe(false);
|
|
50
|
-
expect((0, _1.isNonZeroUint)('- 1')).toBe(false);
|
|
51
|
-
});
|
|
52
|
-
test('quantity', () => {
|
|
53
|
-
expect((0, _1.isQuantity)('0px', ['px', 'em'])).toBe(true);
|
|
54
|
-
expect((0, _1.isQuantity)('.5px', ['px', 'em'])).toBe(true);
|
|
55
|
-
expect((0, _1.isQuantity)('1.5em', ['px', 'em'])).toBe(true);
|
|
56
|
-
expect((0, _1.isQuantity)('1.5cm', ['px', 'em'])).toBe(false);
|
|
57
|
-
expect((0, _1.isQuantity)('1.5px', ['px', 'em'], 'int')).toBe(false);
|
|
58
|
-
expect((0, _1.isQuantity)('-5px', ['px', 'em'], 'int')).toBe(true);
|
|
59
|
-
expect((0, _1.isQuantity)('-5px', ['px', 'em'], 'uint')).toBe(false);
|
|
60
|
-
expect((0, _1.isQuantity)('1.12e+21px', ['px', 'em'], 'float')).toBe(true);
|
|
61
|
-
expect((0, _1.isQuantity)('1.12e+21px', ['px', 'em'], 'int')).toBe(false);
|
|
62
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const is_bcp_47_1 = require("./is-bcp-47");
|
|
4
|
-
const is = (0, is_bcp_47_1.isBCP47)();
|
|
5
|
-
test('en-us', () => {
|
|
6
|
-
expect(is('en-us')).toBe(true);
|
|
7
|
-
});
|
|
8
|
-
test('ja-JP', () => {
|
|
9
|
-
expect(is('ja-JP')).toBe(true);
|
|
10
|
-
});
|
|
11
|
-
test('Empty', () => {
|
|
12
|
-
expect(is('')).toBe(false);
|
|
13
|
-
});
|
|
14
|
-
test('Invalid', () => {
|
|
15
|
-
expect(is(':::')).toBe(false);
|
|
16
|
-
});
|
|
17
|
-
test('Surrounded by spaces', () => {
|
|
18
|
-
expect(is(' en ')).toBe(false);
|
|
19
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|