flow import invariant from 'invariant' ; import { StyleObj } from './StyleSheetTypes' ; function getStyle ( style ) { return style ; } function flattenStyle ( style ? ) { if ( ! style ) { return undefined ; } if ( process . env . NODE_ENV !== 'production' ) { invariant ( style !== true , 'style may be false but not true' ) ; } if ( ! Array . isArray ( style ) ) { return getStyle ( style ) ; } const result = { } ; for ( let i = 0 , styleLength = style . length ; i < styleLength ; ++ i ) { const computedStyle = flattenStyle ( style [ i ] ) ; if ( computedStyle ) { for ( const key in computedStyle ) { const value = computedStyle [ key ] ; result [ key ] = value ; } } } return result ; } export default flattenStyle ;