fix include spaces and char limit

This commit is contained in:
Dominik Natter
2025-03-28 11:26:30 +01:00
parent 5df6cc1248
commit 1429a069a6

View File

@@ -10,7 +10,7 @@ import WordDensity from "@/components/WordDensity";
const config = {
includeSpaces: true,
charLimit: 500,
charLimit: 1000000,
theme: "dark",
};
@@ -38,7 +38,7 @@ export default function Home() {
const result: any = {};
const inputText = text;
result.charCount = includeSpaces ? inputText.length : inputText.replace(/\s/g, "").length;
result.charCount = !includeSpaces ? inputText.length : inputText.replace(/\s/g, "").length;
result.wordCount = (inputText.match(/[a-zA-ZäöüÄÖÜß]+/g) || []).length;
result.sentenceCount = (inputText.match(/[\w\s][.?!](?=\s|$)/g) || []).length;