File tree Expand file tree Collapse file tree 1 file changed +5
-7
lines changed
Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Original file line number Diff line number Diff line change 1- const fs = require ( 'fs' ) ;
2-
1+ const fs = require ( "fs" ) ;
32/**
4- * Looks up anagrams of a given word based on the
3+ * Looks up anagrams of a given word based on the
54 * word dictionary provided in the constructor.
65 */
76class AnagramService {
8-
97 /**
108 * Creates an AnagramService instance
119 * @param {string } dictionaryFilePath Path to the dictionary file
@@ -26,7 +24,7 @@ class AnagramService {
2624 return reject ( err ) ;
2725 }
2826
29- const lines = data . toString ( ) . split ( '\n' ) ;
27+ const lines = data . toString ( ) . split ( "\n" ) ;
3028
3129 lines . forEach ( ( line ) => {
3230 this . wordsMap . set ( line . toLowerCase ( ) , [ line ] ) ;
@@ -38,12 +36,12 @@ class AnagramService {
3836
3937 /**
4038 * Returns all anagrams for the given term
41- * @param {string } term The term to find anagrams for
39+ * @param {string } term The term to find anagrams for
4240 * @returns A string[] of anagram matches
4341 */
4442 async getAnagrams ( term ) {
4543 if ( ! this . wordsMap || this . wordsMap . size === 0 ) {
46- throw Error ( ' Error: Dictionary not initialized' ) ;
44+ throw Error ( " Error: Dictionary not initialized" ) ;
4745 }
4846
4947 // TODO: The anagram lookup 🤦♂️
You can’t perform that action at this time.
0 commit comments