diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2025-01-17 08:44:28 -0400 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2025-01-17 08:44:28 -0400 |
commit | c16763bb2e86e08ca0943562767322139b04f0c6 (patch) | |
tree | 60c5209d2703db77147c89a422e838027324f0c5 /src | |
parent | 90d466482e73e7a00023151e1c894f66d1c2ad79 (diff) |
urls: processObjectToken: don't mutate actually lol
Oooooooops https://discord.com/channels/749042497610842152/854020929113423924/1329790888527794188
Diffstat (limited to 'src')
-rw-r--r-- | src/url-spec.js | 7 |
1 files changed, 3 insertions, 4 deletions
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); |