Formatting
This commit is contained in:
@@ -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 },
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user