17
17
* @property {HtmlNode|CommentNode } node
18
18
*/
19
19
20
- var commentExpression = / \s * ( [ a - z A - Z \d - ] + ) ( \s + ( [ \s \S ] * ) ) ? \s * /
20
+ const commentExpression = / \s * ( [ a - z A - Z \d - ] + ) ( \s + ( [ \s \S ] * ) ) ? \s * /
21
21
22
- var markerExpression = new RegExp (
22
+ const markerExpression = new RegExp (
23
23
'(\\s*<!--' + commentExpression . source + '-->\\s*)'
24
24
)
25
25
@@ -29,30 +29,23 @@ var markerExpression = new RegExp(
29
29
* @returns {Marker|null }
30
30
*/
31
31
export function commentMarker ( node ) {
32
- /** @type {RegExpMatchArray } */
33
- var match
34
- /** @type {number } */
35
- var offset
36
- /** @type {MarkerParameters } */
37
- var parameters
38
-
39
32
if (
40
33
node &&
41
34
typeof node === 'object' &&
42
35
// @ts -ignore hush
43
36
( node . type === 'html' || node . type === 'comment' )
44
37
) {
45
38
// @ts -ignore hush
46
- match = node . value . match (
39
+ const match = node . value . match (
47
40
// @ts -ignore hush
48
41
node . type === 'comment' ? commentExpression : markerExpression
49
42
)
50
43
51
44
// @ts -ignore hush
52
45
if ( match && match [ 0 ] . length === node . value . length ) {
53
46
// @ts -ignore hush
54
- offset = node . type === 'comment' ? 1 : 2
55
- parameters = parseParameters ( match [ offset + 1 ] || '' )
47
+ const offset = node . type === 'comment' ? 1 : 2
48
+ const parameters = parseParameters ( match [ offset + 1 ] || '' )
56
49
57
50
if ( parameters ) {
58
51
return {
@@ -77,7 +70,7 @@ export function commentMarker(node) {
77
70
*/
78
71
function parseParameters ( value ) {
79
72
/** @type {MarkerParameters } */
80
- var parameters = { }
73
+ const parameters = { }
81
74
82
75
return value
83
76
. replace (
@@ -98,7 +91,7 @@ function parseParameters(value) {
98
91
// eslint-disable-next-line max-params
99
92
function replacer ( _ , $1 , $2 , $3 , $4 ) {
100
93
/** @type {MarkerParameterValue } */
101
- var value = $2 || $3 || $4 || ''
94
+ let value = $2 || $3 || $4 || ''
102
95
103
96
if ( value === 'true' || value === '' ) {
104
97
value = true
0 commit comments