Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/getClassName.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import type {
HandleMissingStyleNameOptionType
} from './types';

const DEFAULT_HANDLE_MISSING_STYLENAME_OPTION = 'throw';

const isNamespacedStyleName = (styleName: string): boolean => {
return styleName.indexOf('.') !== -1;
};
Expand All @@ -21,7 +23,8 @@ const getClassNameForNamespacedStyleName = (
const styleNameParts = styleName.split('.');
const importName = styleNameParts[0];
const moduleName = styleNameParts[1];
const handleMissingStyleName = handleMissingStyleNameOption || 'throw';
const handleMissingStyleName = handleMissingStyleNameOption ||
DEFAULT_HANDLE_MISSING_STYLENAME_OPTION;

if (!moduleName) {
if (handleMissingStyleName === 'throw') {
Expand Down Expand Up @@ -66,7 +69,8 @@ type OptionsType = {|
export default (styleNameValue: string, styleModuleImportMap: StyleModuleImportMapType, options?: OptionsType): string => {
const styleModuleImportMapKeys = Object.keys(styleModuleImportMap);

const handleMissingStyleName = options && options.handleMissingStyleName;
const handleMissingStyleName = options && options.handleMissingStyleName ||
DEFAULT_HANDLE_MISSING_STYLENAME_OPTION;

return styleNameValue
.split(' ')
Expand Down