Formatting

This commit is contained in:
2023-11-20 17:27:30 -07:00
parent d862ed7539
commit 62336a2034

View File

@@ -6,15 +6,17 @@ export class IswordService {
private readonly dict: string = '/usr/share/dict/words'; private readonly dict: string = '/usr/share/dict/words';
private readonly dictContents: string[]; private readonly dictContents: string[];
constructor() { constructor() {
this.dictContents = readFileSync(this.dict).toString().split('\n') this.dictContents = readFileSync(this.dict).toString().split('\n');
} }
isWord = (word: string) => isWord = (word: string) => this.dictContents.includes(word);
this.dictContents.includes(word)
areWords = (words: string[]): {[key: string]: boolean} => areWords = (words: string[]): { [key: string]: boolean } =>
words.reduce((acc, word) => { words.reduce(
acc[word] = this.isWord(word) (acc, word) => {
return acc acc[word] = this.isWord(word);
}, {} as {[key: string]: boolean}) return acc;
},
{} as { [key: string]: boolean },
);
} }