Skip to content

Commit 3a4bbc3

Browse files
authored
Merge pull request #12 from vectorsize/master
performance optimisations
2 parents bf32d5f + b758730 commit 3a4bbc3

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, { [key]:
89+
style[key] && theme[key].indexOf(style[key]) === -1
90+
? `${style[key]} ${theme[key]}`
91+
: theme[key] || style[key]
92+
})), style)
9293
}
9394

9495
function validateComposeOption(composeTheme) {

0 commit comments

Comments
 (0)