diff --git a/src/isword/isword.service.ts b/src/isword/isword.service.ts index 5563dec..0290024 100644 --- a/src/isword/isword.service.ts +++ b/src/isword/isword.service.ts @@ -3,18 +3,20 @@ import { readFileSync } from 'fs'; @Injectable() export class IswordService { - private readonly dict: string = '/usr/share/dict/words'; - private readonly dictContents: string[]; - constructor() { - this.dictContents = readFileSync(this.dict).toString().split('\n') - } + private readonly dict: string = '/usr/share/dict/words'; + private readonly dictContents: string[]; + constructor() { + this.dictContents = readFileSync(this.dict).toString().split('\n'); + } - isWord = (word: string) => - this.dictContents.includes(word) + isWord = (word: string) => this.dictContents.includes(word); - areWords = (words: string[]): {[key: string]: boolean} => - words.reduce((acc, word) => { - acc[word] = this.isWord(word) - return acc - }, {} as {[key: string]: boolean}) + areWords = (words: string[]): { [key: string]: boolean } => + words.reduce( + (acc, word) => { + acc[word] = this.isWord(word); + return acc; + }, + {} as { [key: string]: boolean }, + ); }