1
- # hast-util-assert [ ![ Build ] [ build-badge ]] [ build ] [ ![ Coverage ] [ coverage-badge ]] [ coverage ] [ ![ Downloads ] [ downloads-badge ]] [ downloads ] [ ![ Chat ] [ chat-badge ]] [ chat ]
1
+ # hast-util-assert
2
2
3
- Assert [ HAST] [ ] nodes.
3
+ [ ![ Build] [ build-badge ]] [ build ]
4
+ [ ![ Coverage] [ coverage-badge ]] [ coverage ]
5
+ [ ![ Downloads] [ downloads-badge ]] [ downloads ]
6
+ [ ![ Size] [ size-badge ]] [ size ]
7
+ [ ![ Sponsors] [ sponsors-badge ]] [ collective ]
8
+ [ ![ Backers] [ backers-badge ]] [ collective ]
9
+ [ ![ Chat] [ chat-badge ]] [ chat ]
4
10
5
- ## Installation
11
+ [ ** hast** ] [ hast ] utility to assert trees.
12
+
13
+ ## Install
6
14
7
15
[ npm] [ ] :
8
16
9
- ``` bash
17
+ ``` sh
10
18
npm install hast-util-assert
11
19
```
12
20
13
21
## Usage
14
22
15
- ``` javascript
23
+ ``` js
16
24
var assert = require (' hast-util-assert' )
17
25
18
26
assert ({type: ' root' , children: []})
@@ -28,21 +36,24 @@ assert({type: 'element', properties: {}, children: []})
28
36
29
37
## API
30
38
31
- ### ` assert(node ) `
39
+ ### ` assert(tree ) `
32
40
33
- Assert that ` node ` is a valid [ HAST] [ ] node. If ` node ` has ` children ` ,
34
- all children will be asserted as well.
41
+ Assert that the given ` tree ` is a valid [ ** hast** ] [ hast ] [ * tree* ] [ tree ] .
42
+ If ` tree ` is a [ * parent* ] [ parent ] , all [ * children* ] [ child ] will be asserted as
43
+ well.
35
44
36
45
The ` assert.parent ` , ` assert.text ` , ` assert.void ` , and ` assert.wrap `
37
46
methods from [ ` unist-util-assert ` ] [ unist-util-assert ] are also included.
38
47
39
48
## Contribute
40
49
41
- See [ ` contributing.md ` in ` syntax-tree/hast ` ] [ contributing ] for ways to get
50
+ See [ ` contributing.md ` in ` syntax-tree/.github ` ] [ contributing ] for ways to get
42
51
started.
52
+ See [ ` support.md ` ] [ support ] for ways to get help.
43
53
44
- This organisation has a [ Code of Conduct] [ coc ] . By interacting with this
45
- repository, organisation, or community you agree to abide by its terms.
54
+ This project has a [ Code of Conduct] [ coc ] .
55
+ By interacting with this repository, organisation, or community you agree to
56
+ abide by its terms.
46
57
47
58
## License
48
59
@@ -62,20 +73,38 @@ repository, organisation, or community you agree to abide by its terms.
62
73
63
74
[ downloads ] : https://www.npmjs.com/package/hast-util-assert
64
75
76
+ [ size-badge ] : https://img.shields.io/bundlephobia/minzip/hast-util-assert.svg
77
+
78
+ [ size ] : https://bundlephobia.com/result?p=hast-util-assert
79
+
80
+ [ sponsors-badge ] : https://opencollective.com/unified/sponsors/badge.svg
81
+
82
+ [ backers-badge ] : https://opencollective.com/unified/backers/badge.svg
83
+
84
+ [ collective ] : https://opencollective.com/unified
85
+
65
86
[ chat-badge ] : https://img.shields.io/badge/join%20the%20community-on%20spectrum-7b16ff.svg
66
87
67
- [ chat ] : https://spectrum.chat/unified/rehype
88
+ [ chat ] : https://spectrum.chat/unified/syntax-tree
68
89
69
90
[ npm ] : https://docs.npmjs.com/cli/install
70
91
71
92
[ license ] : license
72
93
73
94
[ author ] : https://wooorm.com
74
95
75
- [ hast ] : https://github.com/syntax-tree/hast
96
+ [ contributing ] : https://github.com/syntax-tree/.github/blob/master/contributing.md
97
+
98
+ [ support ] : https://github.com/syntax-tree/.github/blob/master/support.md
99
+
100
+ [ coc ] : https://github.com/syntax-tree/.github/blob/master/code-of-conduct.md
76
101
77
102
[ unist-util-assert ] : https://github.com/syntax-tree/unist-util-assert
78
103
79
- [ contributing ] : https://github.com/syntax-tree/hast/blob/master/contributing.md
104
+ [ tree ] : https://github.com/syntax-tree/unist#tree
80
105
81
- [ coc ] : https://github.com/syntax-tree/hast/blob/master/code-of-conduct.md
106
+ [ parent ] : https://github.com/syntax-tree/unist#parent-1
107
+
108
+ [ child ] : https://github.com/syntax-tree/unist#child
109
+
110
+ [ hast ] : https://github.com/syntax-tree/hast
0 commit comments