Skip to content

Commit

Permalink
refactor(associative): remove obsolete string coercions
Browse files Browse the repository at this point in the history
  • Loading branch information
postspectacular committed Sep 18, 2020
1 parent 19396cf commit 9919c56
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/associative/src/trie-map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export class TrieMap<T> {
find(key: string) {
let node: TrieMap<T> | 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;
Expand Down Expand Up @@ -107,7 +107,7 @@ export class TrieMap<T> {
set(key: string, val: T) {
let node: TrieMap<T> = 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<T>())) : next;
}
Expand All @@ -128,7 +128,7 @@ export class TrieMap<T> {
let i = 0;
let node: TrieMap<T> | 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];
Expand Down

0 comments on commit 9919c56

Please sign in to comment.