File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -2,13 +2,16 @@ import _ from 'lodash';
2
2
3
3
const styleNameIndex = { } ;
4
4
5
- export default ( styleNamePropertyValue : string , allowMultiple : boolean ) : Array < string > => {
5
+ export default ( styleNamePropertyValue : ( string | array ) , allowMultiple : boolean ) : Array < string > => {
6
6
let styleNames ;
7
+ let isArray = Array . isArray ( styleNamePropertyValue )
7
8
8
- if ( styleNameIndex [ styleNamePropertyValue ] ) {
9
+ if ( ! isArray && styleNameIndex [ styleNamePropertyValue ] ) {
9
10
styleNames = styleNameIndex [ styleNamePropertyValue ] ;
10
11
} else {
11
- styleNames = _ . trim ( styleNamePropertyValue ) . split ( ' ' ) ;
12
+ styleNames = isArray
13
+ ? styleNamePropertyValue . filter ( styleNameItem => typeof styleNameItem === 'string' )
14
+ : _ . trim ( styleNamePropertyValue ) . split ( ' ' ) ;
12
15
styleNames = _ . filter ( styleNames ) ;
13
16
14
17
styleNameIndex [ styleNamePropertyValue ] = styleNames ;
You can’t perform that action at this time.
0 commit comments