Skip to content

Commit 1051114

Browse files
committed
Fix check for regex to support new Array#lastIndex proposal
Related to syntax-tree/mdast-util-find-and-replace#1.
1 parent b78072d commit 1051114

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

Diff for: index.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,7 @@ function findAndReplace(tree, find, replace, options) {
1616
var settings
1717
var schema
1818

19-
if (
20-
typeof find === 'string' ||
21-
(find && typeof find.lastIndex === 'number')
22-
) {
19+
if (typeof find === 'string' || (find && typeof find.exec === 'function')) {
2320
schema = [[find, replace]]
2421
} else {
2522
schema = find

0 commit comments

Comments
 (0)