15
15
* @typedef EmbeddedHastFields
16
16
* @property {string } [hName] Defines the tag name of an element
17
17
* @property {Properties } [hProperties] Defines the properties of an element
18
- * @property {Array. <Content> } [hChildren] Defines the (hast) children of an element
18
+ * @property {Array<Content> } [hChildren] Defines the (hast) children of an element
19
19
*
20
- * @typedef {Object. <string, unknown> & EmbeddedHastFields } Data unist data with embedded hast fields
20
+ * @typedef {Record <string, unknown> & EmbeddedHastFields } Data unist data with embedded hast fields
21
21
*
22
22
* @typedef {MdastNode & {data?: Data} } NodeWithData unist node with embedded hast data
23
23
*
24
24
* @callback Handler
25
25
* @param {H } h Handle context
26
26
* @param {any } node mdast node to handle
27
27
* @param {Parent|null } parent Parent of `node`
28
- * @returns {Content|Array. <Content>|null|undefined } hast node
28
+ * @returns {Content|Array<Content>|null|undefined } hast node
29
29
*
30
30
* @callback HFunctionProps
31
31
* @param {MdastNode|PositionLike|null|undefined } node mdast node or unist position
32
32
* @param {string } tagName HTML tag name
33
33
* @param {Properties } props Properties
34
- * @param {Array. <Content>? } [children] hast content
34
+ * @param {Array<Content>? } [children] hast content
35
35
* @returns {Element }
36
36
*
37
37
* @callback HFunctionNoProps
38
38
* @param {MdastNode|PositionLike|null|undefined } node mdast node or unist position
39
39
* @param {string } tagName HTML tag name
40
- * @param {Array. <Content>? } [children] hast content
40
+ * @param {Array<Content>? } [children] hast content
41
41
* @returns {Element }
42
42
*
43
43
* @typedef HFields
46
46
* @property {string } footnoteLabel Label to use to introduce the footnote section
47
47
* @property {string } footnoteBackLabel Label to use to go back to a footnote call from the footnote section
48
48
* @property {(identifier: string) => Definition|null } definition Definition cache
49
- * @property {Object. <string, FootnoteDefinition> } footnoteById Footnote cache
50
- * @property {Array. <string> } footnoteOrder Order in which footnotes occur
51
- * @property {Record. <string, number> } footnoteCounts Counts the same footnote was used
49
+ * @property {Record <string, FootnoteDefinition> } footnoteById Footnote cache
50
+ * @property {Array<string> } footnoteOrder Order in which footnotes occur
51
+ * @property {Record<string, number> } footnoteCounts Counts the same footnote was used
52
52
* @property {Handlers } handlers Applied handlers
53
53
* @property {Handler } unknownHandler Handler for any none not in `passThrough` or otherwise handled
54
54
* @property {(left: NodeWithData|PositionLike|null|undefined, right: Content) => Content } augment Like `h` but lower-level and usable on non-elements.
55
- * @property {Array. <string> } passThrough List of node types to pass through untouched (except for their children).
55
+ * @property {Array<string> } passThrough List of node types to pass through untouched (except for their children).
56
56
*
57
57
* @typedef Options
58
58
* @property {boolean } [allowDangerousHtml=false]
79
79
* Change it if you’re authoring in a different language.
80
80
* @property {Handlers } [handlers]
81
81
* Object mapping mdast nodes to functions handling them
82
- * @property {Array. <string> } [passThrough]
82
+ * @property {Array<string> } [passThrough]
83
83
* List of custom mdast node types to pass through (keep) in hast
84
84
* @property {Handler } [unknownHandler]
85
85
* Handler for all unknown nodes.
86
86
*
87
- * @typedef {Record. <string, Handler> } Handlers
87
+ * @typedef {Record<string, Handler> } Handlers
88
88
* Map of node types to handlers
89
89
* @typedef {HFunctionProps & HFunctionNoProps & HFields } H
90
90
* Handle context
@@ -110,7 +110,7 @@ const own = {}.hasOwnProperty
110
110
function factory ( tree , options ) {
111
111
const settings = options || { }
112
112
const dangerous = settings . allowDangerousHtml || false
113
- /** @type {Object. <string, FootnoteDefinition> } */
113
+ /** @type {Record <string, FootnoteDefinition> } */
114
114
const footnoteById = { }
115
115
116
116
h . dangerous = dangerous
@@ -122,9 +122,9 @@ function factory(tree, options) {
122
122
h . footnoteBackLabel = settings . footnoteBackLabel || 'Back to content'
123
123
h . definition = definitions ( tree )
124
124
h . footnoteById = footnoteById
125
- /** @type {Array. <string> } */
125
+ /** @type {Array<string> } */
126
126
h . footnoteOrder = [ ]
127
- /** @type {Record. <string, number> } */
127
+ /** @type {Record<string, number> } */
128
128
h . footnoteCounts = { }
129
129
h . augment = augment
130
130
h . handlers = { ...handlers , ...settings . handlers }
0 commit comments