Skip to content

Commit 44f5374

Browse files
committed
support template strings in the token based finder
1 parent 46acb22 commit 44f5374

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

find-fast.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ module.exports = function findFast(src, opts) {
3434
if (token.type === acorn.tokTypes.parenR) { // End of fn() call
3535
if (args.length === 1 && args[0].type === acorn.tokTypes.string) {
3636
modules.strings.push(args[0].value);
37+
} else if (args.length === 3 // A template string without any expressions
38+
&& args[0].type === acorn.tokTypes.backQuote
39+
&& args[1].type === acorn.tokTypes.template
40+
&& args[2].type === acorn.tokTypes.backQuote) {
41+
modules.strings.push(args[1].value);
3742
} else if (args.length > 0) {
3843
modules.expressions.push(src.slice(args[0].start, args[args.length - 1].end));
3944
}

0 commit comments

Comments
 (0)