Skip to content

Commit

Permalink
refactor: simplification (#3009)
Browse files Browse the repository at this point in the history
  • Loading branch information
mfranzke authored Aug 8, 2024
1 parent d8a65b3 commit 721c039
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions showcases/screen-reader/default.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,23 @@ const translations: Record<string, string[]> = {
document: ['Dokument']
};

const standardPhrases = [
'You are currently',
'To enter',
'To exit',
'To click',
'To select',
'To interact',
'Press Control'
];

const cleanSpeakInstructions = (phraseLog: string[]): string[] =>
phraseLog.map((phrase) =>
phrase
.split('. ')
.filter(
(sPhrase) =>
!(
sPhrase.includes('You are currently') ||
sPhrase.includes('To enter') ||
sPhrase.includes('To exit') ||
sPhrase.includes('To click') ||
sPhrase.includes('To select') ||
sPhrase.includes('To interact') ||
sPhrase.includes('Press Control')
)
!standardPhrases.some((string) => sPhrase.includes(string))
)
.join('. ')
);
Expand Down

0 comments on commit 721c039

Please sign in to comment.