Skip to content

Commit bc780d5

Browse files
AlbertLuciantogajus
authored andcommitted
refactor: using default handleMissingStyleName from schema (#229)
1 parent 4e4ed24 commit bc780d5

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/getClassName.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,12 @@ import type {
55
StyleModuleImportMapType,
66
HandleMissingStyleNameOptionType
77
} from './types';
8+
import optionsDefaults from './schemas/optionsDefaults';
89

910
type OptionsType = {|
1011
handleMissingStyleName: HandleMissingStyleNameOptionType
1112
|};
1213

13-
const DEFAULT_HANDLE_MISSING_STYLENAME_OPTION = 'throw';
14-
1514
const isNamespacedStyleName = (styleName: string): boolean => {
1615
return styleName.indexOf('.') !== -1;
1716
};
@@ -28,7 +27,7 @@ const getClassNameForNamespacedStyleName = (
2827
const importName = styleNameParts[0];
2928
const moduleName = styleNameParts[1];
3029
const handleMissingStyleName = handleMissingStyleNameOption ||
31-
DEFAULT_HANDLE_MISSING_STYLENAME_OPTION;
30+
optionsDefaults.handleMissingStyleName;
3231

3332
if (!moduleName) {
3433
if (handleMissingStyleName === 'throw') {
@@ -70,7 +69,7 @@ export default (styleNameValue: string, styleModuleImportMap: StyleModuleImportM
7069
const styleModuleImportMapKeys = Object.keys(styleModuleImportMap);
7170

7271
const handleMissingStyleName = options && options.handleMissingStyleName ||
73-
DEFAULT_HANDLE_MISSING_STYLENAME_OPTION;
72+
optionsDefaults.handleMissingStyleName;
7473

7574
if (!styleNameValue) {
7675
return '';

0 commit comments

Comments
 (0)