import { Theme } from '../styles/defaultTheme' ; import { validPropertiesBase , validPropertiesForType } from './constants' ; export interface PropertyValue { property : string ; value : string ; } param { String } classname export const splitAndValidate = ( classname , componentType , theme ) : PropertyValue [ ] => { const validProperties = [ ... validPropertiesBase , ... validPropertiesForType [ componentType ] , ... Object . keys ( theme ) , ] ; const split = classname . split ( ' ' ) ; return split . map ( ( declaration ) => { const [ property , value ] = declaration . split ( '-' ) ; if ( validProperties . includes ( property ) ) { const final = { property , value } ; return final ; } return { property : '' , value : '' } ; } ) . filter ( Boolean ) ; } ;