queue-typed 2.4.1 → 2.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "queue-typed",
3
- "version": "2.4.1",
3
+ "version": "2.4.2",
4
4
  "description": "Queue data structure",
5
5
  "browser": "dist/umd/queue-typed.min.js",
6
6
  "umd:main": "dist/umd/queue-typed.min.js",
@@ -153,6 +153,6 @@
153
153
  "typescript": "^4.9.5"
154
154
  },
155
155
  "dependencies": {
156
- "data-structure-typed": "^2.4.1"
156
+ "data-structure-typed": "^2.4.2"
157
157
  }
158
158
  }
@@ -564,19 +564,17 @@ export class Trie<R = any> extends IterableElementBase<string, R> {
564
564
  const words: string[] = [];
565
565
  let found = 0;
566
566
 
567
- function dfs(node: TrieNode, word: string) {
568
- for (const char of node.children.keys()) {
569
- const charNode = node.children.get(char);
570
- if (charNode !== undefined) {
571
- dfs(charNode, word.concat(char));
572
- }
567
+ const dfs = (node: TrieNode, word: string): void => {
568
+ for (const [char, childNode] of node.children) {
569
+ if (found >= max) return;
570
+ dfs(childNode, word + char);
573
571
  }
574
572
  if (node.isEnd) {
575
- if (found > max - 1) return;
573
+ if (found >= max) return;
576
574
  words.push(word);
577
575
  found++;
578
576
  }
579
- }
577
+ };
580
578
 
581
579
  let startNode = this.root;
582
580