fix: lesson structure issue

This commit is contained in:
Jannat Patel
2024-08-12 20:09:56 +05:30
parent a744a43d14
commit 05ebe4b787
4 changed files with 21 additions and 4 deletions

View File

@@ -483,3 +483,19 @@ export function getLineStartPosition(string, position) {
return position
}
export function singularize(word) {
const endings = {
ves: 'fe',
ies: 'y',
i: 'us',
zes: 'ze',
ses: 's',
es: 'e',
s: ''
};
return word.replace(
new RegExp(`(${Object.keys(endings).join('|')})$`),
r => endings[r]
);
}