From 44f537419bcc15708e74b81d25a0d091eb467a97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9e=20Kooi?= Date: Mon, 25 Dec 2017 10:39:09 +0100 Subject: [PATCH] support template strings in the token based finder --- find-fast.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/find-fast.js b/find-fast.js index bd937ee38..b0465d51e 100644 --- a/find-fast.js +++ b/find-fast.js @@ -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)); }