Skip to content

style: lint tries.ts #242

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions data_structures/tries/tries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ class TrieNode {
/**
* An object that stores child nodes for each character in the alphabet.
*/
children: { [key: string]: TrieNode } = {}
children: Record<string, TrieNode> = {}

/**
* Indicates whether the node represents the end of a word.
*/
isWord: boolean = false
isWord = false
}

/**
Expand All @@ -22,11 +22,6 @@ export class Trie {
*/
root: TrieNode = new TrieNode()

/**
* Creates a new Trie instance.
*/
constructor() {}

/**
* Inserts a word into the Trie.
*
Expand All @@ -51,7 +46,7 @@ export class Trie {
* If false, the method returns true only if an exact match is found.
* @returns True if the word (or prefix) is found in the Trie; otherwise, false.
*/
public find(word: string, isPrefixMatch: boolean = false): boolean {
public find(word: string, isPrefixMatch = false): boolean {
return this.searchNode(this.root, word, isPrefixMatch)
}

Expand Down
Loading