fix(vocabLessonReview): improve input normalization by trimming punctuation
All checks were successful
Deploy to production / deploy (push) Successful in 2m47s
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:
@@ -111,7 +111,9 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
normalize(s) {
|
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) {
|
getItemKey(item) {
|
||||||
return `${String(item?.gloss || '').trim()}|${String(item?.target || '').trim()}`;
|
return `${String(item?.gloss || '').trim()}|${String(item?.target || '').trim()}`;
|
||||||
|
|||||||
Reference in New Issue
Block a user