@@ -63,17 +63,19 @@ type OptionsType = {|
6363 handleMissingStyleName : HandleMissingStyleNameOptionType
6464| } ;
6565
66- export default ( styleNameValue : string , styleModuleImportMap : StyleModuleImportMapType , options : OptionsType ) : string => {
66+ export default ( styleNameValue : string , styleModuleImportMap : StyleModuleImportMapType , options ? : OptionsType ) : string => {
6767 const styleModuleImportMapKeys = Object . keys ( styleModuleImportMap ) ;
6868
69+ const handleMissingStyleName = options && options . handleMissingStyleName ;
70+
6971 return styleNameValue
7072 . split ( ' ' )
7173 . filter ( ( styleName ) => {
7274 return styleName ;
7375 } )
7476 . map ( ( styleName ) => {
7577 if ( isNamespacedStyleName ( styleName ) ) {
76- return getClassNameForNamespacedStyleName ( styleName , styleModuleImportMap , options . handleMissingStyleName ) ;
78+ return getClassNameForNamespacedStyleName ( styleName , styleModuleImportMap , handleMissingStyleName ) ;
7779 }
7880
7981 if ( styleModuleImportMapKeys . length === 0 ) {
@@ -87,10 +89,10 @@ export default (styleNameValue: string, styleModuleImportMap: StyleModuleImportM
8789 const styleModuleMap : StyleModuleMapType = styleModuleImportMap [ styleModuleImportMapKeys [ 0 ] ] ;
8890
8991 if ( ! styleModuleMap [ styleName ] ) {
90- if ( options . handleMissingStyleName === 'throw' ) {
92+ if ( handleMissingStyleName === 'throw' ) {
9193 throw new Error ( 'Could not resolve the styleName \'' + styleName + '\'.' ) ;
9294 }
93- if ( options . handleMissingStyleName === 'warn' ) {
95+ if ( handleMissingStyleName === 'warn' ) {
9496 // eslint-disable-next-line no-console
9597 console . warn ( 'Could not resolve the styleName \'' + styleName + '\'.' ) ;
9698 }
0 commit comments