Skip to content

Commit 35d35b1

Browse files
committed
Change to return undefined
1 parent 9bf44ad commit 35d35b1

File tree

3 files changed

+183
-144
lines changed

3 files changed

+183
-144
lines changed

lib/index.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ const own = {}.hasOwnProperty
9898
* @param {Options | null | undefined} [options]
9999
* Configuration (when `find` is not `Find`).
100100
* @returns {undefined}
101-
* Given, modified, tree.
101+
* Nothing.
102102
*/
103103
// To do: next major: remove `find` & `replace` combo, remove schema.
104104
export function findAndReplace(tree, find, replace, options) {
@@ -129,9 +129,6 @@ export function findAndReplace(tree, find, replace, options) {
129129
visitParents(tree, 'text', visitor)
130130
}
131131

132-
// @ts-expect-error: To do: remove.
133-
return tree
134-
135132
/** @type {import('unist-util-visit-parents').BuildVisitor<Root, 'text'>} */
136133
function visitor(node, parents) {
137134
let index = -1

readme.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ Partial matches are not supported.
152152

153153
###### Returns
154154

155-
Given, modified, tree ([`Node`][node]).
155+
Nothing (`undefined`).
156156

157157
### `Find`
158158

@@ -163,7 +163,7 @@ Strings are escaped and then turned into global expressions.
163163
###### Type
164164

165165
```ts
166-
type Find = string | RegExp
166+
type Find = RegExp | string
167167
```
168168
169169
### `FindAndReplaceList`
@@ -231,7 +231,7 @@ Thing to replace with (TypeScript type).
231231
###### Type
232232
233233
```ts
234-
type Replace = string | ReplaceFunction
234+
type Replace = ReplaceFunction | string
235235
```
236236
237237
See [`ReplaceFunction`][api-replacefunction].

0 commit comments

Comments
 (0)