From c16763bb2e86e08ca0943562767322139b04f0c6 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Fri, 17 Jan 2025 08:44:28 -0400 Subject: urls: processObjectToken: don't mutate actually lol Oooooooops https://discord.com/channels/749042497610842152/854020929113423924/1329790888527794188 --- src/url-spec.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/url-spec.js b/src/url-spec.js index f8ab6c69..4c5964fc 100644 --- a/src/url-spec.js +++ b/src/url-spec.js @@ -40,7 +40,6 @@ function processStringToken(key, token) { } } -// Mutates, so don't even think about reusing the original representation. function processObjectToken(key, token) { const oops = appearance => new Error( @@ -53,7 +52,7 @@ function processObjectToken(key, token) { !Array.isArray(value); if (looksLikeObject(token)) { - return token; + return {...token}; } else if (Array.isArray(token)) { if (empty(token)) { throw oops(`empty array`); @@ -62,7 +61,7 @@ function processObjectToken(key, token) { } else if (token.some(item => !looksLikeObject(item))) { throw oops(`array of mixed objects and non-objects`); } else { - return Object.assign(...token); + return Object.assign({}, ...token); } } } @@ -82,7 +81,7 @@ function makeProcessToken(aggregate) { export function processGroupSpec(groupKey, groupSpec) { const aggregate = - openAggregate({message: `Errors procsesing group "${groupKey}"`}); + openAggregate({message: `Errors processing group "${groupKey}"`}); const processToken = makeProcessToken(aggregate); -- cgit 1.3.0-6-gf8a5