From cf2e81d32f77f3f887b90eb6ff3e6dbac1b53302 Mon Sep 17 00:00:00 2001 From: Kir_Antipov Date: Thu, 4 Jan 2024 10:12:29 +0000 Subject: [PATCH] `MultiMap` handles string values a bit better now --- src/utils/collections/map.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utils/collections/map.ts b/src/utils/collections/map.ts index 3f87d48..c8b2d43 100644 --- a/src/utils/collections/map.ts +++ b/src/utils/collections/map.ts @@ -330,7 +330,7 @@ export class MultiMap extends ArrayMap { * @returns This {@link MultiMap} instance for chaining purposes. */ set(key: K, value: V | Iterable): this { - const values = isIterable(value) ? asArray(value) : [value]; + const values = typeof value !== "string" && isIterable(value) ? asArray(value) : [value]; return super.set(key, values); } @@ -368,7 +368,7 @@ export class MultiMap extends ArrayMap { return this.set(key, value as V); } - if (isIterable(value)) { + if (typeof value !== "string" && isIterable(value)) { existingValues.push(...value); } else { existingValues.push(value);