18
18
* [ Use] ( #use )
19
19
* [ API] ( #api )
20
20
* [ ` u(type[, props][, children|value]) ` ] ( #utype-props-childrenvalue )
21
+ * [ ` ChildrenOrValue ` ] ( #childrenorvalue )
22
+ * [ ` Props ` ] ( #props )
21
23
* [ Types] ( #types )
22
24
* [ Compatibility] ( #compatibility )
23
25
* [ Related] ( #related )
@@ -42,7 +44,7 @@ when creating hast (HTML) or xast (XML) nodes.
42
44
## Install
43
45
44
46
This package is [ ESM only] [ esm ] .
45
- In Node.js (version 12.20+, 14.14+, 16.0+, or 18 .0+), install with [ npm] [ ] :
47
+ In Node.js (version 14.14+ and 16 .0+), install with [ npm] [ ] :
46
48
47
49
``` sh
48
50
npm install unist-builder
@@ -107,7 +109,7 @@ results in the following tree:
107
109
108
110
## API
109
111
110
- This package exports the identifier ` u ` .
112
+ This package exports the identifier [ ` u ` ] [ u ] .
111
113
There is no default export.
112
114
113
115
### ` u(type[, props][, children|value]) `
@@ -135,16 +137,37 @@ Build a node.
135
137
136
138
Built node ([ ` Node ` ] [ node ] ).
137
139
140
+ ### ` ChildrenOrValue `
141
+
142
+ List to use as ` children ` or value to use as ` value ` (TypeScript type).
143
+
144
+ ###### Type
145
+
146
+ ``` ts
147
+ type ChildrenOrValue = Array <Node > | string
148
+ ` ` `
149
+
150
+ ### ` Props `
151
+
152
+ Other fields to add to the node (TypeScript type).
153
+
154
+ ###### Type
155
+
156
+ ` ` ` ts
157
+ export type Props = Record <string , unknown >
158
+ ` ` `
159
+
138
160
## Types
139
161
140
162
This package is fully typed with [TypeScript][].
141
- It exports the additional types ` Props ` and ` ChildrenOrValue ` .
163
+ It exports the additional types [ ` ChildrenOrValue ` ][childrenorvalue] and
164
+ [ ` Props ` ][props].
142
165
143
166
## Compatibility
144
167
145
168
Projects maintained by the unified collective are compatible with all maintained
146
169
versions of Node.js.
147
- As of now, that is Node.js 12.20+, 14.14+, 16.0+, and 18 .0+.
170
+ As of now, that is Node.js 14.14+ and 16 .0+.
148
171
Our projects sometimes work with older versions, but this is not guaranteed.
149
172
150
173
## Related
@@ -229,3 +252,9 @@ abide by its terms.
229
252
[hastscript]: https://github.com/syntax-tree/hastscript
230
253
231
254
[xastscript]: https://github.com/syntax-tree/xastscript
255
+
256
+ [u]: #utype-props-childrenvalue
257
+
258
+ [props]: #props
259
+
260
+ [childrenorvalue]: #childrenorvalue
0 commit comments