Skip to content

Commit a333a33

Browse files
author
Robin Frischmann
committed
improve assignStyle
1 parent 8568365 commit a333a33

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

modules/assignStyle.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
/* @flow */
2-
export default function assignStyle(base: Object, ...extendingStyles: Array<Object>) {
2+
export default function assignStyle(base, ...extendingStyles) {
33
for (let i = 0, len = extendingStyles.length; i < len; ++i) {
4-
const style: Object = extendingStyles[i]
4+
const style = extendingStyles[i]
55

6-
for (const property: string in style) {
7-
const value: any = style[property]
8-
const baseValue: any = base[property]
6+
for (const property in style) {
7+
const value = style[property]
8+
const baseValue = base[property]
99

10-
if (baseValue instanceof Object) {
10+
if (typeof baseValue === 'object') {
1111
if (Array.isArray(baseValue)) {
1212
if (Array.isArray(value)) {
1313
base[property] = [...baseValue, ...value]
@@ -17,7 +17,7 @@ export default function assignStyle(base: Object, ...extendingStyles: Array<Obje
1717
continue
1818
}
1919

20-
if (value instanceof Object && !Array.isArray(value)) {
20+
if (typeof value === 'object' && !Array.isArray(value)) {
2121
base[property] = assignStyle({}, baseValue, value)
2222
continue
2323
}

0 commit comments

Comments
 (0)