tree-multimap-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": "tree-multimap-typed",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.2",
|
|
4
4
|
"description": "TreeMultiMap - A sorted map that allows multiple values per key",
|
|
5
5
|
"browser": "dist/umd/tree-multimap-typed.min.js",
|
|
6
6
|
"umd:main": "dist/umd/tree-multimap-typed.min.js",
|
|
@@ -217,6 +217,6 @@
|
|
|
217
217
|
"typescript": "^4.9.5"
|
|
218
218
|
},
|
|
219
219
|
"dependencies": {
|
|
220
|
-
"data-structure-typed": "^2.4.
|
|
220
|
+
"data-structure-typed": "^2.4.2"
|
|
221
221
|
}
|
|
222
222
|
}
|
|
@@ -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
|
-
|
|
568
|
-
for (const char of node.children
|
|
569
|
-
|
|
570
|
-
|
|
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
|
|
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
|
|