Skip to content

Commit

Permalink
fix: potential problem with default options (#235)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlbertLucianto authored and gajus committed Feb 24, 2019
1 parent 23b3560 commit 0e39c78
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/getClassName.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,10 @@ const getClassNameFromMultipleImports = (
export default (styleNameValue: string, styleModuleImportMap: StyleModuleImportMapType, options?: GetClassNameOptionsType): string => {
const styleModuleImportMapKeys = Object.keys(styleModuleImportMap);

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

const autoResolveMultipleImports = options && options.autoResolveMultipleImports;
const {
handleMissingStyleName = optionsDefaults.handleMissingStyleName,
autoResolveMultipleImports = optionsDefaults.autoResolveMultipleImports
} = options || {};

if (!styleNameValue) {
return '';
Expand Down
6 changes: 4 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,10 @@ export default ({
return;
}

const handleMissingStyleName = stats.opts && stats.opts.handleMissingStyleName || optionsDefaults.handleMissingStyleName;
const autoResolveMultipleImports = stats.opts && stats.opts.autoResolveMultipleImports || optionsDefaults.autoResolveMultipleImports;
const {
handleMissingStyleName = optionsDefaults.handleMissingStyleName,
autoResolveMultipleImports = optionsDefaults.autoResolveMultipleImports
} = stats.opts || {};

for (const attribute of attributes) {
const destinationName = attributeNames[attribute.name.name];
Expand Down

0 comments on commit 0e39c78

Please sign in to comment.