File tree 2 files changed +5
-9
lines changed
2 files changed +5
-9
lines changed Original file line number Diff line number Diff line change 1
1
/**
2
2
* @typedef {import('mdast').Root|import('mdast').Content } Node
3
3
* @typedef {import('mdast').Definition } Definition
4
- * @typedef {import('unist-util-visit').Visitor<Definition> } DefinitionVisitor
5
4
*/
6
5
7
6
import { visit } from 'unist-util-visit'
@@ -20,17 +19,14 @@ export function definitions(node) {
20
19
throw new Error ( 'mdast-util-definitions expected node' )
21
20
}
22
21
23
- visit ( node , 'definition' , ondefinition )
24
-
25
- return getDefinition
26
-
27
- /** @type {DefinitionVisitor } */
28
- function ondefinition ( definition ) {
22
+ visit ( node , 'definition' , ( definition ) => {
29
23
const id = clean ( definition . identifier )
30
24
if ( id && ! own . call ( cache , id ) ) {
31
25
cache [ id ] = definition
32
26
}
33
- }
27
+ } )
28
+
29
+ return getDefinition
34
30
35
31
/**
36
32
* Get a node from the bound definition-cache.
Original file line number Diff line number Diff line change 37
37
"dependencies" : {
38
38
"@types/mdast" : " ^3.0.0" ,
39
39
"@types/unist" : " ^2.0.0" ,
40
- "unist-util-visit" : " ^3 .0.0"
40
+ "unist-util-visit" : " ^4 .0.0"
41
41
},
42
42
"devDependencies" : {
43
43
"@types/tape" : " ^4.0.0" ,
You can’t perform that action at this time.
0 commit comments