From e05c06377b055da76586a7a8ad2a836d9eac805f Mon Sep 17 00:00:00 2001 From: Alexis Munsayac Date: Wed, 1 Jul 2020 15:42:53 +0800 Subject: [PATCH] Change param to indexable object --- src/radix/result.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/radix/result.ts b/src/radix/result.ts index cf71dfc..88fd59c 100644 --- a/src/radix/result.ts +++ b/src/radix/result.ts @@ -27,10 +27,13 @@ */ import { RadixNode } from './node'; +export interface RadixResultParams { + [key: string]: string; +} export interface RadixResult { nodes: RadixNode[]; key: string; - params?: Map; + params: RadixResultParams; payload?: T; } @@ -38,6 +41,7 @@ export function createRadixResult(): RadixResult { return { nodes: [], key: '', + params: {}, }; } @@ -59,8 +63,5 @@ export function setRadixResultParams( key: string, value: string, ): void { - if (!result.params) { - result.params = new Map(); - } - result.params.set(key, value); + result.params[key] = value; }