Skip to content

Commit

Permalink
don't mutate, create new object
Browse files Browse the repository at this point in the history
  • Loading branch information
robinweser committed Apr 24, 2024
1 parent ea15b37 commit 5644237
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions packages/brandeur-plugin-prefixer/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

Expand Down

0 comments on commit 5644237

Please sign in to comment.