From 9919c56181340c949d126bff34c288677d509b00 Mon Sep 17 00:00:00 2001 From: Karsten Schmidt Date: Fri, 18 Sep 2020 21:47:37 +0100 Subject: [PATCH] refactor(associative): remove obsolete string coercions --- packages/associative/src/trie-map.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/associative/src/trie-map.ts b/packages/associative/src/trie-map.ts index 756f1ee65f..3175b2d3c6 100644 --- a/packages/associative/src/trie-map.ts +++ b/packages/associative/src/trie-map.ts @@ -75,7 +75,7 @@ export class TrieMap { find(key: string) { let node: TrieMap | undefined = this; for (let i = 0, n = key.length; i < n; i++) { - node = node!.next[key[i].toString()]; + node = node!.next[key[i]]; if (!node) return; } return node; @@ -107,7 +107,7 @@ export class TrieMap { set(key: string, val: T) { let node: TrieMap = this; for (let i = 0, n = key.length; i < n; i++) { - const k = key[i].toString(); + const k = key[i]; const next = node.next[k]; node = !next ? (node.n++, (node.next[k] = new TrieMap())) : next; } @@ -128,7 +128,7 @@ export class TrieMap { let i = 0; let node: TrieMap | undefined = this; for (; i < n; i++) { - const k = prefix[i].toString(); + const k = prefix[i]; key.push(k); path.push(node); node = node.next[k];