88[ ![ Backers] [ backers-badge ]] [ collective ]
99[ ![ Chat] [ chat-badge ]] [ chat ]
1010
11- Assert [ Unist ] [ ] nodes .
11+ [ ** unist ** ] [ unist ] utility to assert trees .
1212
13- ## Installation
13+ ## Install
1414
1515[ npm] [ ] :
1616
@@ -20,7 +20,7 @@ npm install unist-util-assert
2020
2121## Usage
2222
23- ``` javascript
23+ ``` js
2424var assert = require (' unist-util-assert' )
2525
2626assert ({type: ' root' , children: []})
@@ -46,41 +46,43 @@ assert({type: 'paragraph', children: ['foo']})
4646
4747## API
4848
49- ### ` assert(node ) `
49+ ### ` assert(tree ) `
5050
51- Assert that ` node ` is a valid [ Unist ] [ ] node. If ` node ` has ` children ` ,
52- all children will be asserted as well.
51+ Assert that [ ` tree ` ] [ tree ] is a valid [ unist ] [ ] [ node] [ ] .
52+ If ` tree ` is a [ parent ] [ ] , all [ child ] [ ] ren will be asserted as well.
5353
54- ### ` assert.parent(node ) `
54+ ### ` assert.parent(tree ) `
5555
56- Assert that ` node ` is a valid Unist [ Parent] [ ] .
56+ Assert that ` tree ` is a valid [ unist] [ ] [ parent] [ ] .
57+ All [ child] [ ] ren will be asserted as well.
5758
5859### ` assert.text(node) `
5960
60- Assert that ` node ` is a valid Unist [ Text ] [ ] .
61+ Assert that ` node ` is a valid [ unist ] [ ] [ literal ] [ ] .
6162
6263### ` assert.void(node) `
6364
64- Assert that ` node ` is a valid Unist node, but neither Text nor Parent.
65+ Assert that ` node ` is a valid [ unist] [ ] [ node] [ ] , but neither [ parent] [ ] nor
66+ [ literal] [ ] .
6567
6668## Extensions
6769
68- This module can be used as a base to test subsets of Unist (for an
69- example, see [ ` mdast-util-assert ` ] [ mdast-util-assert ] ). All functions
70- which are exposed from such a module, and functions used internally to
71- test child nodes , should be wrapped in ` assert.wrap ` , which adds an
72- inspectable string of the respective node, and its parent when available,
73- to exposed error message.
70+ This module can be used as a base to test subsets of [ unist ] [ ] (for an example,
71+ see [ ` mdast-util-assert ` ] [ mdast-util-assert ] ).
72+ All functions that are exposed from such a module, and functions used internally
73+ to test [ child] [ ] ren , should be wrapped in ` assert.wrap ` , which adds an
74+ inspectable string of the respective node, and its parent when available, to
75+ the exposed error message.
7476
7577### ` assert.wrap(fn) `
7678
77- Wraps a function (which is passed a node, and an optional parent node),
78- so that any errors thrown inside it will contain information regarding
79- the node (and the parent, when given).
79+ Wraps ` fn ` (which is passed a node, and an optional parent node), so that any
80+ errors thrown inside it will contain information regarding the node (and the
81+ parent, when given).
8082
8183## Related
8284
83- * [ ` mdast-util-assert ` ] ( https://github.com/syntax-tree/ mdast-util-assert)
85+ * [ ` mdast-util-assert ` ] [ mdast-util-assert ]
8486 — Check [ mdast] ( https://github.com/syntax-tree/mdast ) nodes
8587* [ ` hast-util-assert ` ] ( https://github.com/syntax-tree/hast-util-assert )
8688 — Check [ hast] ( https://github.com/syntax-tree/hast ) nodes
@@ -89,11 +91,13 @@ the node (and the parent, when given).
8991
9092## Contribute
9193
92- See [ ` contributing.md ` in ` syntax-tree/unist ` ] [ contributing ] for ways to get
94+ See [ ` contributing.md ` in ` syntax-tree/.github ` ] [ contributing ] for ways to get
9395started.
96+ See [ ` support.md ` ] [ support ] for ways to get help.
9497
95- This organisation has a [ Code of Conduct] [ coc ] . By interacting with this
96- repository, organisation, or community you agree to abide by its terms.
98+ This project has a [ Code of Conduct] [ coc ] .
99+ By interacting with this repository, organisation, or community you agree to
100+ abide by its terms.
97101
98102## License
99103
@@ -133,14 +137,22 @@ repository, organisation, or community you agree to abide by its terms.
133137
134138[ author ] : https://wooorm.com
135139
140+ [ contributing ] : https://github.com/syntax-tree/.github/blob/master/contributing.md
141+
142+ [ support ] : https://github.com/syntax-tree/.github/blob/master/support.md
143+
144+ [ coc ] : https://github.com/syntax-tree/.github/blob/master/code-of-conduct.md
145+
136146[ unist ] : https://github.com/syntax-tree/unist
137147
138148[ parent ] : https://github.com/syntax-tree/unist#parent
139149
140- [ text ] : https://github.com/syntax-tree/unist#text
150+ [ literal ] : https://github.com/syntax-tree/unist#literal
141151
142- [ mdast-util-assert ] : https://github.com/syntax-tree/mdast-util-assert
152+ [ node ] : https://github.com/syntax-tree/unist#node
153+
154+ [ tree ] : https://github.com/syntax-tree/unist#tree
143155
144- [ contributing ] : https://github.com/syntax-tree/unist/blob/master/contributing.md
156+ [ child ] : https://github.com/syntax-tree/unist#child
145157
146- [ coc ] : https://github.com/syntax-tree/unist/blob/master/code-of-conduct.md
158+ [ mdast-util-assert ] : https://github.com/syntax-tree/mdast-util-assert
0 commit comments