Skip to content

Commit

Permalink
support template strings in the token based finder
Browse files Browse the repository at this point in the history
  • Loading branch information
goto-bus-stop committed Dec 25, 2017
1 parent 46acb22 commit 44f5374
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions find-fast.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ module.exports = function findFast(src, opts) {
if (token.type === acorn.tokTypes.parenR) { // End of fn() call
if (args.length === 1 && args[0].type === acorn.tokTypes.string) {
modules.strings.push(args[0].value);
} else if (args.length === 3 // A template string without any expressions
&& args[0].type === acorn.tokTypes.backQuote
&& args[1].type === acorn.tokTypes.template
&& args[2].type === acorn.tokTypes.backQuote) {
modules.strings.push(args[1].value);
} else if (args.length > 0) {
modules.expressions.push(src.slice(args[0].start, args[args.length - 1].end));
}
Expand Down

0 comments on commit 44f5374

Please sign in to comment.