Use regex to match whitespace

This commit is contained in:
Cohee 2024-02-02 21:30:32 +02:00
parent e4025cb413
commit 4649c806e0
1 changed files with 1 additions and 1 deletions

View File

@ -478,7 +478,7 @@ export function trimToEndSentence(input, include_newline = false) {
const char = input[i];
if (punctuation.has(char)) {
if (i > 0 && (input[i - 1] === ' ' || input[i - 1] === '\n')) {
if (i > 0 && /[\s\n]/.test(input[i - 1])) {
last = i - 1;
} else {
last = i;