Skip to content

Commit fa8fdc2

Browse files
committed
fix: type error
1 parent be965e8 commit fa8fdc2

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

evap/static/ts/src/text-answer-warnings.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ function isTextMeaningless(text: string): boolean {
66
return text.length > 0 && ["", "ka", "na", "none", "keine", "keines", "keiner"].includes(text.replace(/\W/g, ""));
77
}
88

9-
function containsSubArray<Type>(arr: Type[], sub: Type[]): boolean {
9+
function containsPhrase(arr: string[], sub: string[]): boolean {
1010
for (let i = 0; i <= arr.length - sub.length; i++) {
1111
let j;
1212
for (j = 0; j < sub.length; j++) {
1313
if (j == sub.length - 1 && arr[i + j].length > sub[j].length) {
1414
if (!arr[i + j].startsWith(sub[j])) break;
15-
if (null !== arr[i + j].substring(sub[j].length).match(RegExp("^[!?.]*$", ""))) return true;
15+
if (null !== RegExp("^[!?.]*$", "").exec(arr[i + j].substring(sub[j].length))) return true;
1616
}
1717
if (arr[i + j] !== sub[j]) break;
1818
}
@@ -24,7 +24,7 @@ function containsSubArray<Type>(arr: Type[], sub: Type[]): boolean {
2424
function matchesTriggerString(text: string, triggerString: string): boolean {
2525
const words = text.split(" ");
2626
const triggerWords = triggerString.split(" ");
27-
return containsSubArray(words, triggerWords);
27+
return containsPhrase(words, triggerWords);
2828
}
2929

3030
function doesTextContainTriggerString(text: string, triggerStrings: string[]): boolean {

0 commit comments

Comments
 (0)