fix include spaces and char limit
This commit is contained in:
@@ -10,7 +10,7 @@ import WordDensity from "@/components/WordDensity";
|
|||||||
|
|
||||||
const config = {
|
const config = {
|
||||||
includeSpaces: true,
|
includeSpaces: true,
|
||||||
charLimit: 500,
|
charLimit: 1000000,
|
||||||
theme: "dark",
|
theme: "dark",
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -38,7 +38,7 @@ export default function Home() {
|
|||||||
const result: any = {};
|
const result: any = {};
|
||||||
const inputText = text;
|
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.wordCount = (inputText.match(/[a-zA-ZäöüÄÖÜß]+/g) || []).length;
|
||||||
result.sentenceCount = (inputText.match(/[\w\s][.?!](?=\s|$)/g) || []).length;
|
result.sentenceCount = (inputText.match(/[\w\s][.?!](?=\s|$)/g) || []).length;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user