@markuplint/types 3.0.0-canary.5 → 3.0.0-dev.177
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 +1 -1
- package/lib/check-multi-types.d.ts +4 -1
- package/lib/check-multi-types.js +5 -4
- package/lib/check.d.ts +6 -5
- package/lib/check.spec.js +64 -58
- package/lib/css-syntax.js +49 -47
- package/lib/css-syntax.spec.js +152 -149
- package/lib/defs.js +2 -2
- package/lib/enum.d.ts +2 -1
- package/lib/enum.js +1 -1
- package/lib/get-candidate.d.ts +4 -1
- package/lib/keyword-type.js +3 -2
- package/lib/list.d.ts +2 -1
- package/lib/list.js +2 -1
- package/lib/list.spec.js +118 -117
- package/lib/match-result.d.ts +21 -8
- package/lib/match-result.js +2 -1
- package/lib/number.d.ts +1 -1
- package/lib/primitive/index.spec.js +53 -52
- package/lib/primitive/is-quantity.d.ts +5 -1
- package/lib/primitive/is-uint.d.ts +6 -3
- package/lib/primitive/split-unit.d.ts +2 -2
- package/lib/primitive/split-unit.js +2 -2
- package/lib/rfc/is-bcp-47.spec.js +9 -8
- package/lib/token/token-collection.d.ts +71 -56
- package/lib/token/token-collection.js +30 -23
- package/lib/token/token-collection.spec.js +156 -134
- package/lib/token/token.d.ts +58 -52
- package/lib/token/token.js +19 -20
- package/lib/token/types.d.ts +3 -0
- package/lib/token/types.js +2 -0
- package/lib/types.d.ts +79 -55
- package/lib/types.schema.d.ts +1084 -31
- package/lib/w3c/check-serialized-permissions-policy.spec.js +30 -28
- package/lib/whatwg/check-autocomplete.js +6 -6
- package/lib/whatwg/check-autocomplete.spec.js +361 -360
- package/lib/whatwg/check-datetime/datetime-tokens.d.ts +21 -1
- package/lib/whatwg/check-datetime/datetime-tokens.js +9 -6
- package/lib/whatwg/check-datetime/duration-string.js +12 -2
- package/lib/whatwg/check-datetime/index.spec.js +277 -276
- package/lib/whatwg/check-datetime/local-date-and-time-string.js +6 -2
- package/lib/whatwg/check-datetime/time-zone-offset-string.d.ts +1 -1
- package/lib/whatwg/check-datetime/time-zone-offset-string.js +3 -2
- package/lib/whatwg/check-mime-type.d.ts +4 -4
- package/lib/whatwg/check-mime-type.js +1 -1
- package/lib/whatwg/check-mime-type.spec.js +53 -52
- package/lib/whatwg/is-abs-url.spec.js +6 -5
- package/lib/whatwg/is-itemprop-name.js +1 -1
- package/package.json +12 -10
- package/{src/check.spec.ts → test/check.spec.js} +7 -1
- package/{src/css-syntax.spec.ts → test/css-syntax.spec.js} +10 -12
- package/{src/list.spec.ts → test/list.spec.js} +7 -7
- package/{src/primitive/index.spec.ts → test/primitive/index.spec.js} +1 -1
- package/{src/rfc/is-bcp-47.spec.ts → test/rfc/is-bcp-47.spec.js} +1 -1
- package/{src/token/token-collection.spec.ts → test/token/token-collection.spec.js} +2 -3
- package/{src/w3c/check-serialized-permissions-policy.spec.ts → test/w3c/check-serialized-permissions-policy.spec.js} +1 -3
- package/{src/whatwg/check-autocomplete.spec.ts → test/whatwg/check-autocomplete.spec.js} +1 -1
- package/{src/whatwg/check-datetime/index.spec.ts → test/whatwg/check-datetime/index.spec.js} +18 -15
- package/{src/whatwg/check-mime-type.spec.ts → test/whatwg/check-mime-type.spec.js} +1 -1
- package/{src/whatwg/is-abs-url.spec.ts → test/whatwg/is-abs-url.spec.js} +1 -1
- package/types.schema.json +369 -318
- package/gen/specific-schema.json +0 -98
- package/gen/types.ts +0 -66
- package/src/check-multi-types.ts +0 -35
- package/src/check.ts +0 -48
- 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.ts +0 -34
- package/src/match-result.ts +0 -49
- package/src/number.ts +0 -46
- 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.ts +0 -13
- package/src/token/index.ts +0 -2
- package/src/token/token-collection.ts +0 -444
- package/src/token/token.ts +0 -144
- package/src/types.schema.ts +0 -1062
- package/src/types.ts +0 -118
- package/src/w3c/check-serialized-permissions-policy.ts +0 -303
- 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.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.ts +0 -46
- 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/css-syntax.spec.js
CHANGED
|
@@ -1,157 +1,160 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
const css_syntax_1 = require('./css-syntax');
|
|
4
5
|
test('CSS Standard', () => {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
expect((0, css_syntax_1.cssSyntaxMatch)('10px', '<length>').matched).toBe(true);
|
|
7
|
+
expect((0, css_syntax_1.cssSyntaxMatch)('one-pixel', '<length>').matched).toBe(false);
|
|
8
|
+
expect((0, css_syntax_1.cssSyntaxMatch)('(prefers-color-scheme: dark)', '<media-query-list>').matched).toBe(true);
|
|
8
9
|
});
|
|
9
10
|
test('Extends', () => {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
11
|
+
const sourceSizeList = {
|
|
12
|
+
ref: 'https://html.spec.whatwg.org/multipage/images.html#sizes-attributes',
|
|
13
|
+
syntax: {
|
|
14
|
+
apply: '<source-size-list>',
|
|
15
|
+
def: {
|
|
16
|
+
'source-size-list': '[ <source-size># , ]? <source-size-value>',
|
|
17
|
+
'source-size': '<media-condition> <source-size-value>',
|
|
18
|
+
'source-size-value': '<length>',
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
expect((0, css_syntax_1.cssSyntaxMatch)('50vw', sourceSizeList).matched).toBe(true);
|
|
23
|
+
expect((0, css_syntax_1.cssSyntaxMatch)('(max-width: 600px) 200px, 50vw', sourceSizeList).matched).toBe(true);
|
|
24
|
+
expect((0, css_syntax_1.cssSyntaxMatch)('print 300vw', sourceSizeList).matched).toBe(false);
|
|
25
|
+
expect((0, css_syntax_1.cssSyntaxMatch)('(max-width: 600px) 200px', sourceSizeList).matched).toBe(false);
|
|
26
|
+
expect(
|
|
27
|
+
(0, css_syntax_1.cssSyntaxMatch)('(max-width: 600px) 200px', {
|
|
28
|
+
...sourceSizeList,
|
|
29
|
+
syntax: {
|
|
30
|
+
...sourceSizeList.syntax,
|
|
31
|
+
apply: '<source-size>',
|
|
32
|
+
},
|
|
33
|
+
}).matched,
|
|
34
|
+
).toBe(true);
|
|
35
|
+
const keyTimes = {
|
|
36
|
+
ref: 'https://svgwg.org/specs/animations/#KeyTimesAttribute',
|
|
37
|
+
syntax: {
|
|
38
|
+
apply: '<key-times>',
|
|
39
|
+
def: {
|
|
40
|
+
'key-times': '<number> [; <number>]* [;]?',
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
expect((0, css_syntax_1.cssSyntaxMatch)('20; 20; 30', keyTimes).matched).toBe(true);
|
|
45
|
+
expect((0, css_syntax_1.cssSyntaxMatch)('20; 20; 30;', keyTimes).matched).toBe(true);
|
|
46
|
+
expect((0, css_syntax_1.cssSyntaxMatch)('20; 20; abc;', keyTimes).matched).toBe(false);
|
|
47
|
+
expect((0, css_syntax_1.cssSyntaxMatch)('20; 20; ;', keyTimes).matched).toBe(false);
|
|
48
|
+
const SVGViewBox = {
|
|
49
|
+
ref: 'https://svgwg.org/svg2-draft/coords.html#ViewBoxAttribute',
|
|
50
|
+
syntax: {
|
|
51
|
+
apply: '<view-box>',
|
|
52
|
+
def: {
|
|
53
|
+
'view-box': '<min-x> [,]? <min-y> [,]? <width> [,]? <height>',
|
|
54
|
+
'min-x': '<number>',
|
|
55
|
+
'min-y': '<number>',
|
|
56
|
+
width: '<number>',
|
|
57
|
+
height: '<number>',
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
expect((0, css_syntax_1.cssSyntaxMatch)('0 0 30 10', SVGViewBox).matched).toBe(true);
|
|
62
|
+
expect((0, css_syntax_1.cssSyntaxMatch)('0 0, 30, 10', SVGViewBox).matched).toBe(true);
|
|
63
|
+
expect((0, css_syntax_1.cssSyntaxMatch)('0 0, 30', SVGViewBox).matched).toBe(false);
|
|
64
|
+
const percentageList = {
|
|
65
|
+
ref: 'https://developer.mozilla.org/en-US/docs/Web/SVG/Content_type#percentage',
|
|
66
|
+
syntax: {
|
|
67
|
+
apply: '<percentage-list>',
|
|
68
|
+
def: {
|
|
69
|
+
'percentage-list': '[ <number> [,]? ]* <number>',
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
expect((0, css_syntax_1.cssSyntaxMatch)('0 0 30 10', percentageList).matched).toBe(true);
|
|
74
|
+
expect((0, css_syntax_1.cssSyntaxMatch)('0, 0, 30 10', percentageList).matched).toBe(true);
|
|
75
|
+
expect((0, css_syntax_1.cssSyntaxMatch)('0', percentageList).matched).toBe(true);
|
|
76
|
+
expect((0, css_syntax_1.cssSyntaxMatch)('', percentageList).matched).toBe(false);
|
|
77
|
+
const custom = {
|
|
78
|
+
ref: 'n/a',
|
|
79
|
+
syntax: {
|
|
80
|
+
apply: '<custom>',
|
|
81
|
+
def: {
|
|
82
|
+
custom: '0 | 1 | .',
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
};
|
|
86
|
+
expect((0, css_syntax_1.cssSyntaxMatch)('0', custom).matched).toBe(true);
|
|
87
|
+
expect((0, css_syntax_1.cssSyntaxMatch)('1', custom).matched).toBe(true);
|
|
88
|
+
expect((0, css_syntax_1.cssSyntaxMatch)('.', custom).matched).toBe(true);
|
|
89
|
+
expect((0, css_syntax_1.cssSyntaxMatch)('2', custom).matched).toBe(false);
|
|
90
|
+
expect((0, css_syntax_1.cssSyntaxMatch)(':', custom).matched).toBe(false);
|
|
88
91
|
});
|
|
89
92
|
test('custom-type-checking', () => {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
93
|
+
const custom = {
|
|
94
|
+
ref: 'n/a',
|
|
95
|
+
caseSensitive: true,
|
|
96
|
+
syntax: {
|
|
97
|
+
apply: '<custom>',
|
|
98
|
+
def: {
|
|
99
|
+
custom: '<custom-type>',
|
|
100
|
+
'custom-type': token => {
|
|
101
|
+
if (!token) {
|
|
102
|
+
return 0;
|
|
103
|
+
}
|
|
104
|
+
return token.value === '1' ? 1 : 0;
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
};
|
|
109
|
+
expect((0, css_syntax_1.cssSyntaxMatch)('1', custom).matched).toBe(true);
|
|
110
|
+
expect((0, css_syntax_1.cssSyntaxMatch)('0', custom).matched).toBe(false);
|
|
108
111
|
});
|
|
109
112
|
test('case-sensitive', () => {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
113
|
+
const custom = {
|
|
114
|
+
ref: 'n/a',
|
|
115
|
+
caseSensitive: true,
|
|
116
|
+
syntax: {
|
|
117
|
+
apply: '<custom>',
|
|
118
|
+
def: {
|
|
119
|
+
custom: 'CaSeS [a | B | aBc]',
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
};
|
|
123
|
+
expect((0, css_syntax_1.cssSyntaxMatch)('CaSeS a', custom).matched).toBe(true);
|
|
124
|
+
expect((0, css_syntax_1.cssSyntaxMatch)('CaSeS B', custom).matched).toBe(true);
|
|
125
|
+
expect((0, css_syntax_1.cssSyntaxMatch)('CaSeS aBc', custom).matched).toBe(true);
|
|
126
|
+
expect((0, css_syntax_1.cssSyntaxMatch)('CaSeS A', custom)).toStrictEqual({
|
|
127
|
+
column: 7,
|
|
128
|
+
line: 1,
|
|
129
|
+
matched: false,
|
|
130
|
+
length: 1,
|
|
131
|
+
offset: 6,
|
|
132
|
+
partName: 'value',
|
|
133
|
+
raw: 'A',
|
|
134
|
+
reason: 'syntax-error',
|
|
135
|
+
ref: 'n/a',
|
|
136
|
+
expects: [
|
|
137
|
+
{
|
|
138
|
+
type: 'syntax',
|
|
139
|
+
value: '<custom>',
|
|
140
|
+
},
|
|
141
|
+
],
|
|
142
|
+
});
|
|
143
|
+
expect((0, css_syntax_1.cssSyntaxMatch)('CaSeS abc', custom)).toStrictEqual({
|
|
144
|
+
column: 7,
|
|
145
|
+
line: 1,
|
|
146
|
+
matched: false,
|
|
147
|
+
length: 3,
|
|
148
|
+
offset: 6,
|
|
149
|
+
partName: 'value',
|
|
150
|
+
raw: 'abc',
|
|
151
|
+
reason: 'syntax-error',
|
|
152
|
+
ref: 'n/a',
|
|
153
|
+
expects: [
|
|
154
|
+
{
|
|
155
|
+
type: 'syntax',
|
|
156
|
+
value: '<custom>',
|
|
157
|
+
},
|
|
158
|
+
],
|
|
159
|
+
});
|
|
157
160
|
});
|
package/lib/defs.js
CHANGED
|
@@ -115,7 +115,7 @@ exports.types = {
|
|
|
115
115
|
reason: 'unexpected-space',
|
|
116
116
|
});
|
|
117
117
|
}
|
|
118
|
-
if (
|
|
118
|
+
if (tokens.length === 0) {
|
|
119
119
|
return (0, match_result_1.unmatched)(value, 'empty-token');
|
|
120
120
|
}
|
|
121
121
|
return (0, match_result_1.matched)();
|
|
@@ -431,7 +431,7 @@ exports.types = {
|
|
|
431
431
|
if (!height) {
|
|
432
432
|
return sep.unmatched({ reason: 'unexpected-token' });
|
|
433
433
|
}
|
|
434
|
-
if (tail
|
|
434
|
+
if (tail[0]) {
|
|
435
435
|
return tail[0].unmatched({ reason: 'extra-token' });
|
|
436
436
|
}
|
|
437
437
|
if (!(0, primitive_1.isUint)(width.value)) {
|
package/lib/enum.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { Result } from './types';
|
|
2
2
|
import type { Enum } from './types.schema';
|
|
3
|
-
|
|
3
|
+
import type { ReadonlyDeep } from 'type-fest';
|
|
4
|
+
export declare function checkEnum(value: string, type: ReadonlyDeep<Enum>, ref?: string): Result;
|
package/lib/enum.js
CHANGED
|
@@ -9,7 +9,7 @@ function checkEnum(value, type, ref) {
|
|
|
9
9
|
if (!disallowToSurroundBySpaces) {
|
|
10
10
|
value = value.trim();
|
|
11
11
|
}
|
|
12
|
-
let values = type.enum;
|
|
12
|
+
let values = type.enum.slice();
|
|
13
13
|
if (caseInsensitive) {
|
|
14
14
|
value = value.toLowerCase();
|
|
15
15
|
values = type.enum.map(v => v.toLowerCase());
|
package/lib/get-candidate.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
type NullableString = string | null | undefined;
|
|
2
|
-
export declare function getCandidate(
|
|
2
|
+
export declare function getCandidate(
|
|
3
|
+
value: NullableString,
|
|
4
|
+
...candidates: readonly (NullableString | readonly NullableString[])[]
|
|
5
|
+
): string | undefined;
|
|
3
6
|
export {};
|
package/lib/keyword-type.js
CHANGED
|
@@ -33,6 +33,7 @@ function checkKeywordType(value, type, cache = true) {
|
|
|
33
33
|
}
|
|
34
34
|
exports.checkKeywordType = checkKeywordType;
|
|
35
35
|
function _checkKeywordType(value, type) {
|
|
36
|
+
var _a, _b;
|
|
36
37
|
const def = defs_1.types[type];
|
|
37
38
|
if (!def) {
|
|
38
39
|
(0, debug_1.log)('The "%s" type is not defined in custom type identifier markuplint specified', type);
|
|
@@ -51,8 +52,8 @@ function _checkKeywordType(value, type) {
|
|
|
51
52
|
if (!matches.matched) {
|
|
52
53
|
return {
|
|
53
54
|
...matches,
|
|
54
|
-
ref: matches.ref
|
|
55
|
-
expects: matches.expects
|
|
55
|
+
ref: (_a = matches.ref) !== null && _a !== void 0 ? _a : def.ref,
|
|
56
|
+
expects: (_b = matches.expects) !== null && _b !== void 0 ? _b : def.expects,
|
|
56
57
|
};
|
|
57
58
|
}
|
|
58
59
|
return matches;
|
package/lib/list.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { Result } from './types';
|
|
2
2
|
import type { List } from './types.schema';
|
|
3
|
-
|
|
3
|
+
import type { ReadonlyDeep } from 'type-fest';
|
|
4
|
+
export declare function checkList(value: string, type: ReadonlyDeep<List>, ref?: string, cache?: boolean): Result;
|
package/lib/list.js
CHANGED
|
@@ -5,6 +5,7 @@ const check_1 = require("./check");
|
|
|
5
5
|
const match_result_1 = require("./match-result");
|
|
6
6
|
const token_1 = require("./token");
|
|
7
7
|
function checkList(value, type, ref, cache = true) {
|
|
8
|
+
var _a;
|
|
8
9
|
const tokens = new token_1.TokenCollection(value, type);
|
|
9
10
|
const matches = tokens.check({ ref });
|
|
10
11
|
if (!matches.matched) {
|
|
@@ -17,7 +18,7 @@ function checkList(value, type, ref, cache = true) {
|
|
|
17
18
|
const { offset, line, column } = token_1.Token.shiftLocation(token, res.offset);
|
|
18
19
|
return {
|
|
19
20
|
...res,
|
|
20
|
-
partName: res.partName
|
|
21
|
+
partName: (_a = res.partName) !== null && _a !== void 0 ? _a : 'the content of the list',
|
|
21
22
|
offset,
|
|
22
23
|
line,
|
|
23
24
|
column,
|