Skip to content

Commit 8722c2a

Browse files
author
Victor Saiz
committed
performance optimisations
1 parent bf32d5f commit 8722c2a

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/components/themr.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,12 @@ export default (componentName, localTheme, options = {}) => (ThemedComponent) =>
8484

8585
function themeable(style = {}, theme) {
8686
if (!theme) return style
87-
return [ ...Object.keys(theme), ...Object.keys(style) ].reduce((result, key) => (
88-
typeof theme[key] === 'string' && style[key] && theme[key].indexOf(style[key]) === -1
89-
? { ...result, [key]: `${style[key]} ${theme[key]}` }
90-
: { ...result, [key]: theme[key] || style[key] }
91-
), {})
87+
return Object.keys(theme).reduce((result, key) => (
88+
Object.assign(result,
89+
style[key] && theme[key].indexOf(style[key]) === -1
90+
? { [key]: `${style[key]} ${theme[key]}` }
91+
: { [key]: theme[key] || style[key] }
92+
)), style)
9293
}
9394

9495
function validateComposeOption(composeTheme) {

0 commit comments

Comments
 (0)