Skip to content

Commit d42b962

Browse files
authored
style: lint tries.ts (#242)
* style: resolve `consistent-indexed-object-style` * style: remove redundant constructor * style: resolve `non-inferrable-types`
1 parent 8c8a0ec commit d42b962

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

data_structures/tries/tries.ts

+3-8
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ class TrieNode {
55
/**
66
* An object that stores child nodes for each character in the alphabet.
77
*/
8-
children: { [key: string]: TrieNode } = {}
8+
children: Record<string, TrieNode> = {}
99

1010
/**
1111
* Indicates whether the node represents the end of a word.
1212
*/
13-
isWord: boolean = false
13+
isWord = false
1414
}
1515

1616
/**
@@ -22,11 +22,6 @@ export class Trie {
2222
*/
2323
root: TrieNode = new TrieNode()
2424

25-
/**
26-
* Creates a new Trie instance.
27-
*/
28-
constructor() {}
29-
3025
/**
3126
* Inserts a word into the Trie.
3227
*
@@ -51,7 +46,7 @@ export class Trie {
5146
* If false, the method returns true only if an exact match is found.
5247
* @returns True if the word (or prefix) is found in the Trie; otherwise, false.
5348
*/
54-
public find(word: string, isPrefixMatch: boolean = false): boolean {
49+
public find(word: string, isPrefixMatch = false): boolean {
5550
return this.searchNode(this.root, word, isPrefixMatch)
5651
}
5752

0 commit comments

Comments
 (0)