Skip to content

Commit d36f901

Browse files
authored
Merge pull request javivelasco#17 from denisborovikov/master
Replace Object.assign with spread syntax
2 parents 243df3d + 57b4dd1 commit d36f901

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/components/themr.js

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

6767
getTheme() {
6868
return this.props.composeTheme === COMPOSE_SOFTLY
69-
? Object.assign({}, this.getContextTheme(), localTheme, this.getNamespacedTheme())
69+
? { ...this.getContextTheme(), ...localTheme, ...this.getNamespacedTheme() }
7070
: themeable(themeable(this.getContextTheme(), localTheme), this.getNamespacedTheme())
7171
}
7272

@@ -98,9 +98,8 @@ export default (componentName, localTheme, options = {}) => (ThemedComponent) =>
9898

9999
export function themeable(style = {}, theme) {
100100
if (!theme) return style
101-
return Object.keys(theme).reduce((result, key) => (
102-
Object.assign(result, { [key]: `${style[key]} ${theme[key]}` })
103-
), Object.assign({}, style))
101+
return Object.keys(theme).reduce((result, key) =>
102+
({ ...result, [key]: `${style[key]} ${theme[key]}` }), style)
104103
}
105104

106105
function validateComposeOption(composeTheme) {
@@ -114,6 +113,6 @@ function validateComposeOption(composeTheme) {
114113
}
115114

116115
function removeNamespace(key, themeNamespace) {
117-
const capitilized = key.substr(themeNamespace.length)
118-
return capitilized.slice(0, 1).toLowerCase() + capitilized.slice(1)
116+
const capitalized = key.substr(themeNamespace.length)
117+
return capitalized.slice(0, 1).toLowerCase() + capitalized.slice(1)
119118
}

0 commit comments

Comments
 (0)