@@ -38,7 +38,7 @@ But this helps when integrating with the rest of unified and unist.
38
38
## Install
39
39
40
40
This package is [ ESM only] [ esm ] .
41
- In Node.js (version 12.20+, 14.14+, 16.0+, 18 .0+), install with [ npm] [ ] :
41
+ In Node.js (version 14.14+ and 16 .0+), install with [ npm] [ ] :
42
42
43
43
``` sh
44
44
npm install unist-util-find-before
@@ -47,14 +47,14 @@ npm install unist-util-find-before
47
47
In Deno with [ ` esm.sh ` ] [ esmsh ] :
48
48
49
49
``` js
50
- import {findBefore } from " https://esm.sh/unist-util-find-before@3"
50
+ import {findBefore } from ' https://esm.sh/unist-util-find-before@3'
51
51
```
52
52
53
53
In browsers with [ ` esm.sh ` ] [ esmsh ] :
54
54
55
55
``` html
56
56
<script type =" module" >
57
- import {findBefore } from " https://esm.sh/unist-util-find-before@3?bundle"
57
+ import {findBefore } from ' https://esm.sh/unist-util-find-before@3?bundle'
58
58
</script >
59
59
```
60
60
@@ -87,18 +87,28 @@ Yields:
87
87
88
88
## API
89
89
90
- This package exports the identifier ` findBefore ` .
90
+ This package exports the identifier [ ` findBefore ` ] [ api-findbefore ] .
91
91
There is no default export.
92
92
93
93
### ` findBefore(parent, node|index[, test]) `
94
94
95
- Find the first node in ` parent ` ([ ` Parent ` ] [ parent ] ) before another ` node `
96
- ([ ` Node ` ] [ node ] ) or before an index, that passes ` test ` (` Test ` from
97
- [ ` unist-util-is ` ] [ test ] ).
95
+ Find the first node in ` parent ` before another ` node ` or before an index,
96
+ that passes ` test ` .
97
+
98
+ ###### Parameters
99
+
100
+ * ` parent ` ([ ` Node ` ] [ node ] )
101
+ — parent node
102
+ * ` index ` (` number ` )
103
+ — index of child in ` parent `
104
+ * ` child ` ([ ` Node ` ] [ node ] )
105
+ — child in ` parent `
106
+ * ` test ` ([ ` Test ` ] [ test ] )
107
+ — ` unist-util-is ` -compatible test
98
108
99
109
###### Returns
100
110
101
- Child of ` parent ` that passes ` test ` , if found ([ ` Node? ` ] [ node ] ).
111
+ Child of ` parent ` ([ ` Node ` ] [ node ] ) or ` null ` .
102
112
103
113
## Types
104
114
@@ -109,7 +119,7 @@ It exports no additional types (types for the test are in `unist-util-is`).
109
119
110
120
Projects maintained by the unified collective are compatible with all maintained
111
121
versions of Node.js.
112
- As of now, that is Node.js 12.20+, 14.14+, 16.0+, and 18 .0+.
122
+ As of now, that is Node.js 14.14+ and 16 .0+.
113
123
Our projects sometimes work with older versions, but this is not guaranteed.
114
124
115
125
## Related
@@ -203,6 +213,6 @@ abide by its terms.
203
213
204
214
[ node ] : https://github.com/syntax-tree/unist#node
205
215
206
- [ parent ] : https://github.com/syntax-tree/unist#parent-1
207
-
208
216
[ test ] : https://github.com/syntax-tree/unist-util-is#test
217
+
218
+ [ api-findbefore ] : #findbeforeparent-nodeindex-test
0 commit comments