Skip to content

Commit

Permalink
Change to return undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Jul 8, 2023
1 parent 9bf44ad commit 35d35b1
Show file tree
Hide file tree
Showing 3 changed files with 183 additions and 144 deletions.
5 changes: 1 addition & 4 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ const own = {}.hasOwnProperty
* @param {Options | null | undefined} [options]
* Configuration (when `find` is not `Find`).
* @returns {undefined}
* Given, modified, tree.
* Nothing.
*/
// To do: next major: remove `find` & `replace` combo, remove schema.
export function findAndReplace(tree, find, replace, options) {
Expand Down Expand Up @@ -129,9 +129,6 @@ export function findAndReplace(tree, find, replace, options) {
visitParents(tree, 'text', visitor)
}

// @ts-expect-error: To do: remove.
return tree

/** @type {import('unist-util-visit-parents').BuildVisitor<Root, 'text'>} */
function visitor(node, parents) {
let index = -1
Expand Down
6 changes: 3 additions & 3 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ Partial matches are not supported.

###### Returns

Given, modified, tree ([`Node`][node]).
Nothing (`undefined`).

### `Find`

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

```ts
type Find = string | RegExp
type Find = RegExp | string
```
### `FindAndReplaceList`
Expand Down Expand Up @@ -231,7 +231,7 @@ Thing to replace with (TypeScript type).
###### Type
```ts
type Replace = string | ReplaceFunction
type Replace = ReplaceFunction | string
```
See [`ReplaceFunction`][api-replacefunction].
Expand Down
Loading

0 comments on commit 35d35b1

Please sign in to comment.