import { ResolvedDeclarations } from '../style' ; export function parseDeclarationBlock ( declarations ) { let block = '' ; let property ; for ( property in declarations ) { const value = declarations [ property ] ; if ( typeof value === 'object' ) { for ( const fallback of value ) { if ( block ) { block += ';' ; } block += parseDeclaration ( property , fallback ) ; } } else { if ( block ) { block += ';' ; } block += parseDeclaration ( property , value ) ; } } return block ; } export function parseDeclaration ( property , value ? ) { return `${ hyphenateProperty ( property ) }:${ value }` ; } const hyphenateRegex = /(?:^(ms|moz|webkit))|[A-Z]/g ; const propertyCache = { } ; export function hyphenateProperty ( property ) { return property in propertyCache ? propertyCache [ property ] : ( propertyCache [ property ] = property . replace ( hyphenateRegex , '-$&' ) . toLowerCase ( ) ) ; }