From 4b99246547050e433cb253cb2f99eef15cc25922 Mon Sep 17 00:00:00 2001 From: Mikael Sand Date: Sat, 19 Oct 2019 22:56:04 +0300 Subject: [PATCH] refactor: optimize propsAndStyles --- src/lib/extract/extractProps.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/lib/extract/extractProps.ts b/src/lib/extract/extractProps.ts index 09ac5610..f8b07726 100644 --- a/src/lib/extract/extractProps.ts +++ b/src/lib/extract/extractProps.ts @@ -17,10 +17,12 @@ import { Component } from 'react'; export function propsAndStyles(props: Object & { style?: [] | {} }) { const { style } = props; - return { - ...(Array.isArray(style) ? Object.assign({}, ...style) : style), - ...props, - }; + return !style + ? props + : { + ...(Array.isArray(style) ? Object.assign({}, ...style) : style), + ...props, + }; } function getMarker(marker?: string) {