Skip to content

Commit

Permalink
Change param to indexable object
Browse files Browse the repository at this point in the history
  • Loading branch information
lxsmnsyc committed Jul 1, 2020
1 parent 16a8145 commit e05c063
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/radix/result.ts
Expand Up @@ -27,17 +27,21 @@
*/
import { RadixNode } from './node';

export interface RadixResultParams {
[key: string]: string;
}
export interface RadixResult<T> {
nodes: RadixNode<T>[];
key: string;
params?: Map<string, string>;
params: RadixResultParams;
payload?: T;
}

export function createRadixResult<T>(): RadixResult<T> {
return {
nodes: [],
key: '',
params: {},
};
}

Expand All @@ -59,8 +63,5 @@ export function setRadixResultParams<T>(
key: string,
value: string,
): void {
if (!result.params) {
result.params = new Map();
}
result.params.set(key, value);
result.params[key] = value;
}

0 comments on commit e05c063

Please sign in to comment.