Skip to content

Commit 5d37488

Browse files
committed
Refactor code-style
1 parent fae4aa4 commit 5d37488

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

index.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,29 @@
11
/**
2-
* @typedef {string|number|boolean} MarkerParameterValue
32
* @typedef {import('mdast').Root} Root
43
* @typedef {import('mdast').Content} Content
54
* @typedef {import('mdast').HTML} HTML
65
* @typedef {import('mdast-util-mdx-expression').MDXFlowExpression} MDXFlowExpression
76
* @typedef {import('mdast-util-mdx-expression').MDXTextExpression} MDXTextExpression
87
* @typedef {Root|Content} Node
9-
* @typedef {Object.<string, MarkerParameterValue>} MarkerParameters
8+
*
9+
* @typedef {string|number|boolean} MarkerParameterValue
10+
* @typedef {Record<string, MarkerParameterValue>} MarkerParameters
1011
*
1112
* @typedef Mdx1CommentNode
1213
* @property {'comment'} type
1314
* @property {string} value
1415
*
1516
* @typedef Marker
17+
* Comment marker.
1618
* @property {string} name
19+
* Name of marker.
1720
* @property {string} attributes
21+
* Value after name.
1822
* @property {MarkerParameters|null} parameters
23+
* Parsed attributes, with decimal numbers, `true`, and `false` casted to
24+
* numbers and booleans.
1925
* @property {HTML|Mdx1CommentNode|MDXFlowExpression|MDXTextExpression} node
26+
* Reference to given node.
2027
*/
2128

2229
const commentExpression = /\s*([a-zA-Z\d-]+)(\s+([\s\S]*))?\s*/
@@ -29,8 +36,11 @@ const markerExpression = new RegExp(
2936

3037
/**
3138
* Parse a comment marker.
39+
*
3240
* @param {unknown} value
41+
* `Node` to parse.
3342
* @returns {Marker|null}
43+
* Information, when applicable.
3444
*/
3545
export function commentMarker(value) {
3646
if (

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@
3131
"index.d.ts",
3232
"index.js"
3333
],
34+
"dependencies": {
35+
"mdast-util-mdx-expression": "^1.1.0"
36+
},
3437
"devDependencies": {
3538
"@types/mdast": "^3.0.10",
3639
"@types/tape": "^4.0.0",
@@ -75,8 +78,5 @@
7578
"atLeast": 100,
7679
"detail": true,
7780
"strict": true
78-
},
79-
"dependencies": {
80-
"mdast-util-mdx-expression": "^1.1.0"
8181
}
8282
}

0 commit comments

Comments
 (0)