88[ ![ Backers] [ backers-badge ]] [ collective ]
99[ ![ Chat] [ chat-badge ]] [ chat ]
1010
11- [ ** mdast** ] [ mdast ] utility to assert trees.
11+ [ mdast] [ ] utility to assert trees.
1212
13- ## Install
13+ ## Contents
14+
15+ * [ What is this?] ( #what-is-this )
16+ * [ When should I use this?] ( #when-should-i-use-this )
17+ * [ Install] ( #install )
18+ * [ Use] ( #use )
19+ * [ API] ( #api )
20+ * [ ` assert(node) ` ] ( #assertnode )
21+ * [ Types] ( #types )
22+ * [ Compatibility] ( #compatibility )
23+ * [ Security] ( #security )
24+ * [ Related] ( #related )
25+ * [ Contribute] ( #contribute )
26+ * [ License] ( #license )
27+
28+ ## What is this?
29+
30+ This package is a tiny utility that helps you deal with nodes.
31+
32+ ## When should I use this?
1433
15- This package is [ ESM only ] ( https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c ) :
16- Node 12+ is needed to use it and it must be ` import ` ed instead of ` require ` d .
34+ This utility is typically useful when you expect certain nodes in your APIs
35+ and want to make sure they’re valid and as expected .
1736
18- [ npm] [ ] :
37+ A different utility, [ ` unist-util-assert ` ] [ unist-util-assert ] , does the same but
38+ for any [ unist] [ ] node.
39+
40+ ## Install
41+
42+ This package is [ ESM only] [ esm ] .
43+ In Node.js (version 12.20+, 14.14+, or 16.0+), install with [ npm] [ ] :
1944
2045``` sh
2146npm install mdast-util-assert
2247```
2348
49+ In Deno with [ ` esm.sh ` ] [ esmsh ] :
50+
51+ ``` js
52+ import {assert } from ' https://esm.sh/mdast-util-assert@4'
53+ ```
54+
55+ In browsers with [ ` esm.sh ` ] [ esmsh ] :
56+
57+ ``` html
58+ <script type =" module" >
59+ import {assert } from ' https://esm.sh/mdast-util-assert@4?bundle'
60+ </script >
61+ ```
62+
2463## Use
2564
2665``` js
@@ -40,8 +79,8 @@ assert({type: 'paragraph', value: 'foo'})
4079
4180## API
4281
43- This package exports the following identifiers: ` assert ` , ` parent ` , ` literal ` ,
44- ` _void ` , ` wrap ` .
82+ This package exports the identifiers ` assert ` , ` parent ` , ` literal ` , ` _void ` ,
83+ and ` wrap ` .
4584There is no default export.
4685
4786### ` assert(node) `
@@ -50,7 +89,27 @@ Assert that [`tree`][tree] is a valid [mdast][] [node][].
5089If ` tree ` is a [ parent] [ ] , all [ child] [ ] ren will be asserted as well.
5190
5291The ` parent ` , ` literal ` , ` _void ` , and ` wrap ` methods from
53- [ ` unist-util-assert ` ] [ unist-util-assert ] are also included.
92+ [ ` unist-util-assert ` ] [ unist-util-assert ] are also exported.
93+
94+ ###### Throws
95+
96+ When ` node ` , or one of its children, is not a valid mdast node.
97+
98+ ###### Returns
99+
100+ Nothing.
101+
102+ ## Types
103+
104+ This package is fully typed with [ TypeScript] [ ] .
105+ It does not export additional types.
106+
107+ ## Compatibility
108+
109+ Projects maintained by the unified collective are compatible with all maintained
110+ versions of Node.js.
111+ As of now, that is Node.js 12.20+, 14.14+, and 16.0+.
112+ Our projects sometimes work with older versions, but this is not guaranteed.
54113
55114## Security
56115
@@ -60,16 +119,16 @@ openings for [cross-site scripting (XSS)][xss] attacks.
60119## Related
61120
62121* [ ` unist-util-assert ` ] [ unist-util-assert ]
63- — check [ unist] ( https://github.com/syntax-tree/unist ) nodes
122+ — check unist nodes
64123* [ ` hast-util-assert ` ] ( https://github.com/syntax-tree/hast-util-assert )
65- — check [ hast] ( https://github.com/syntax-tree/hast ) nodes
124+ — check hast nodes
66125* [ ` nlcst-test ` ] ( https://github.com/syntax-tree/nlcst-test )
67- — check [ nlcst] ( https://github.com/syntax-tree/nlcst ) nodes
126+ — check nlcst nodes
68127
69128## Contribute
70129
71- See [ ` contributing.md ` in ` syntax-tree/.github ` ] [ contributing ] for ways to get
72- started.
130+ See [ ` contributing.md ` ] [ contributing ] in [ ` syntax-tree/.github ` ] [ health ] for
131+ ways to get started.
73132See [ ` support.md ` ] [ support ] for ways to get help.
74133
75134This project has a [ code of conduct] [ coc ] .
@@ -110,28 +169,38 @@ abide by its terms.
110169
111170[ npm ] : https://docs.npmjs.com/cli/install
112171
172+ [ esm ] : https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
173+
174+ [ esmsh ] : https://esm.sh
175+
176+ [ typescript ] : https://www.typescriptlang.org
177+
113178[ license ] : license
114179
115180[ author ] : https://wooorm.com
116181
117- [ contributing ] : https://github.com/syntax-tree/.github/blob/HEAD/contributing.md
182+ [ health ] : https://github.com/syntax-tree/.github
118183
119- [ support ] : https://github.com/syntax-tree/.github/blob/HEAD/support .md
184+ [ contributing ] : https://github.com/syntax-tree/.github/blob/main/contributing .md
120185
121- [ coc ] : https://github.com/syntax-tree/.github/blob/HEAD/code-of-conduct .md
186+ [ support ] : https://github.com/syntax-tree/.github/blob/main/support .md
122187
123- [ mdast ] : https://github.com/syntax-tree/mdast
188+ [ coc ] : https://github.com/syntax-tree/.github/blob/main/code-of-conduct.md
124189
125- [ unist-util-assert ] : https://github.com/syntax-tree/unist-util-assert
190+ [ xss ] : https://en.wikipedia.org/wiki/Cross-site_scripting
191+
192+ [ unist ] : https://github.com/syntax-tree/unist
126193
127194[ tree ] : https://github.com/syntax-tree/unist#tree
128195
129196[ child ] : https://github.com/syntax-tree/unist#child
130197
198+ [ unist-util-assert ] : https://github.com/syntax-tree/unist-util-assert
199+
200+ [ mdast ] : https://github.com/syntax-tree/mdast
201+
131202[ node ] : https://github.com/syntax-tree/mdast#nodes
132203
133204[ parent ] : https://github.com/syntax-tree/mdast#parent
134205
135- [ xss ] : https://en.wikipedia.org/wiki/Cross-site_scripting
136-
137206[ hast ] : https://github.com/syntax-tree/hast
0 commit comments