Skip to content

Commit 474546f

Browse files
committed
Fix case where false resulted in a skipped node
1 parent ac9ef88 commit 474546f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Diff for: lib/index.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,10 @@ export function findAndReplace(tree, find, replace, options) {
141141
value = value.length > 0 ? {type: 'text', value} : undefined
142142
}
143143

144-
if (value !== false) {
144+
// It wasn’t a match after all.
145+
if (value === false) {
146+
position = undefined
147+
} else {
145148
if (start !== position) {
146149
nodes.push({type: 'text', value: node.value.slice(start, position)})
147150
}

0 commit comments

Comments
 (0)