1717* [ Install] ( #install )
1818* [ Use] ( #use )
1919* [ API] ( #api )
20- * [ ` definitions(node ) ` ] ( #definitionsnode )
21- * [ ` definition(identifier) ` ] ( #definitionidentifier )
20+ * [ ` definitions(tree ) ` ] ( #definitionstree )
21+ * [ ` GetDefinition ` ] ( #getdefinition )
2222* [ Types] ( #types )
2323* [ Compatibility] ( #compatibility )
2424* [ Security] ( #security )
@@ -39,7 +39,7 @@ It’s small and protects against prototype pollution.
3939## Install
4040
4141This package is [ ESM only] [ esm ] .
42- In Node.js (version 12.20+, 14.14+, or 16.0+), install with [ npm] [ ] :
42+ In Node.js (version 14.14+ and 16.0+), install with [ npm] [ ] :
4343
4444``` sh
4545npm install mdast-util-definitions
@@ -78,37 +78,49 @@ definition('foo')
7878
7979## API
8080
81- This package exports the identifier ` definitions ` .
81+ This package exports the identifier [ ` definitions ` ] [ api-definitions ] .
8282There is no default export.
8383
84- ### ` definitions(node ) `
84+ ### ` definitions(tree ) `
8585
86- Find [ definition] [ ] s in ` node ` ([ ` Node ` ] [ node ] ).
87- Uses CommonMark precedence, which means that earlier definitions are preferred
88- over duplicate later definitions.
86+ Find definitions in ` tree ` .
87+
88+ Uses CommonMark precedence, which means that earlier definitions are
89+ preferred over duplicate later definitions.
90+
91+ ###### Parameters
92+
93+ * ` tree ` ([ ` Node ` ] [ node ] )
94+ — tree to check
8995
9096###### Returns
9197
92- ` definition ` ([ ` Function ` ] [ fn-definition ] ).
98+ Getter ([ ` GetDefinition ` ] [ api-getdefinition ] ).
99+
100+ ### ` GetDefinition `
93101
94- ### ` definition( identifier) `
102+ Get a definition by identifier (TypeScript type).
95103
96- Get a node from the bound definition cache by its ` identifier ` (` string ` ).
104+ ###### Parameters
105+
106+ * ` identifier ` (` string ` , optional)
107+ — identifier of definition
97108
98109###### Returns
99110
100- [ Definition] [ ] , if found ([ ` Node? ` ] [ node ] )
111+ Definition corresponding to ` identifier ` ([ ` Definition ` ] [ definition ] ) or
112+ ` null ` .
101113
102114## Types
103115
104116This package is fully typed with [ TypeScript] [ ] .
105- There are no additional exported types .
117+ It exports the additional type [ ` GetDefinition ` ] [ api-getdefinition ] .
106118
107119## Compatibility
108120
109121Projects maintained by the unified collective are compatible with all maintained
110122versions of Node.js.
111- As of now, that is Node.js 12.20+, 14.14+, and 16.0+.
123+ As of now, that is Node.js 14.14+ and 16.0+.
112124Our projects sometimes work with older versions, but this is not guaranteed.
113125
114126## Security
@@ -188,10 +200,12 @@ abide by its terms.
188200
189201[ node ] : https://github.com/syntax-tree/unist#node
190202
191- [ fn-definition ] : #definitionidentifier
192-
193203[ definition ] : https://github.com/syntax-tree/mdast#definition
194204
195205[ xss ] : https://en.wikipedia.org/wiki/Cross-site_scripting
196206
197207[ hast ] : https://github.com/syntax-tree/hast
208+
209+ [ api-definitions ] : #definitionstree
210+
211+ [ api-getdefinition ] : #getdefinition
0 commit comments