fix(vocabLessonReview): improve input normalization by trimming punctuation
All checks were successful
Deploy to production / deploy (push) Successful in 2m47s

- Enhanced the `normalize` method to trim trailing punctuation marks (.,!?;:) from input strings, ensuring cleaner and more consistent user input.
- Added logic to replace multiple spaces with a single space, improving the overall formatting of normalized strings.
This commit is contained in:
Torsten Schulz (local)
2026-04-16 15:23:00 +02:00
parent 44850d5913
commit e26a3333c4

View File

@@ -111,7 +111,9 @@ export default {
},
methods: {
normalize(s) {
return String(s || '').trim().toLowerCase();
const base = String(s || '').trim().toLowerCase();
// Satzzeichen am Ende ignorieren (Punkt, Fragezeichen, Ausrufezeichen, Komma, Strichpunkt, Doppelpunkt)
return base.replace(/[.,!?;:]+$/g, '').replace(/\s+/g, ' ');
},
getItemKey(item) {
return `${String(item?.gloss || '').trim()}|${String(item?.target || '').trim()}`;