From 5644237bc1ff6401e8dac80ae0576de106563bdb Mon Sep 17 00:00:00 2001 From: Robin Weser Date: Wed, 24 Apr 2024 11:30:03 +0200 Subject: [PATCH] don't mutate, create new object --- packages/brandeur-plugin-prefixer/src/index.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/packages/brandeur-plugin-prefixer/src/index.js b/packages/brandeur-plugin-prefixer/src/index.js index 9f03e79..6bce683 100644 --- a/packages/brandeur-plugin-prefixer/src/index.js +++ b/packages/brandeur-plugin-prefixer/src/index.js @@ -47,21 +47,23 @@ const prefixes = { export default function prefixerPlugin() { return function addVendorPrefixes(style) { - for (let property in style) { + const prefixed = {} + + for (const property in style) { const value = style[property] if (isObject(value)) { - style[property] = addVendorPrefixes(value) + prefixed[property] = addVendorPrefixes(value) } else { if (prefixes[property]) { - delete style[property] - style[prefixes[property] + capitalize(property)] = value - style[property] = value + prefixed[prefixes[property] + capitalize(property)] = value } + + prefixed[property] = value } } - return style + return prefixed } }