1
- # unist-util-find -all-between
1
+ # unist-util-replace -all-between
2
2
3
3
[ ** unist** ] ( https://github.com/syntax-tree/unist ) utility to modify an existing child list to replace all elements between all
4
4
instances of two nodes
@@ -8,14 +8,14 @@ instances of two nodes
8
8
[ npm] ( https://docs.npmjs.com/cli/install ) :
9
9
10
10
``` sh
11
- npm install unist-util-find -all-between
11
+ npm install unist-util-replace -all-between
12
12
```
13
13
14
14
## Usage
15
15
16
16
``` js
17
17
import u from ' unist-builder'
18
- import findAllBetween from ' unist-util-find -all-between'
18
+ import replaceAllBetween from ' unist-util-replace -all-between'
19
19
20
20
const tree = u (' root' , [
21
21
u (' start' , ' 1' ),
@@ -27,7 +27,7 @@ const tree = u('root', [
27
27
u (' end' , ' 4' ),
28
28
])
29
29
30
- const newChildren = findAllBetween (tree, {type: ' start' }, {type: ' end' }, () => [u (' replaced' , ' 1' )])
30
+ const newChildren = replaceAllBetween (tree, {type: ' start' }, {type: ' end' }, () => [u (' replaced' , ' 1' )])
31
31
32
32
console .dir (newChildren, {depth: null })
33
33
```
@@ -44,7 +44,7 @@ Yields:
44
44
45
45
## API
46
46
47
- ### ` findAllBetween (parent, start, end, func)`
47
+ ### ` replaceAllBetween (parent, start, end, func)`
48
48
49
49
Mutate an existing parent's children to reflect function return
50
50
0 commit comments