Skip to content

Commit f1b6a84

Browse files
yaronskayaanatolystansler
authored andcommitted
fix: react (#151) (#166)
1 parent d4a6d02 commit f1b6a84

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/main/kotlin/app/extractors/JavascriptExtractor.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,10 @@ class JavascriptExtractor : ExtractorInterface {
2727

2828
val splitRegex =
2929
Regex("""\s+|,|;|:|\*|\n|\(|\)|\\[|]|\{|}|\+|=|\.|>|<|#|@|\$""")
30-
val fileTokens = fileContent.joinToString(separator = " ").toLowerCase()
30+
val twoOrMoreWordsRegex = Regex("""(".+?\s.+?[^"]*"|'.+?\s.+?[^']*')""")
31+
val fileTokens = twoOrMoreWordsRegex.replace(fileContent.joinToString(separator = " ").toLowerCase(), "")
3132
.split(splitRegex)
33+
3234
imports.addAll(fileTokens.filter { token -> token in LIBRARIES })
3335

3436
return imports.toList()

0 commit comments

Comments
 (0)