@codecademy/gamut
72.5.072.5.1-alpha.279d23.0
dist/Form/SelectDropdown/core/utils.js~
dist/Form/SelectDropdown/core/utils.jsModified+2−1
Index: package/dist/Form/SelectDropdown/core/utils.js
===================================================================
--- package/dist/Form/SelectDropdown/core/utils.js
+++ package/dist/Form/SelectDropdown/core/utils.js
@@ -1,4 +1,5 @@
+import { isDefined } from '../../../utils/nullish';
export const isMultipleSelectProps = props => !!props.multiple;
export const isSingleSelectProps = props => !props.multiple;
/**
* Resolves the value for a newly created option from react-select action metadata
@@ -15,9 +16,9 @@
}
const newOption = optionEvent.find(option => option.__isNew__);
return newOption?.value || undefined;
};
-export const isOptionGroup = obj => obj != null && typeof obj === 'object' && 'options' in obj && obj.options !== undefined;
+export const isOptionGroup = obj => isDefined(obj) && typeof obj === 'object' && obj !== null && 'options' in obj && obj.options !== undefined;
export const isOptionsGrouped = options => Array.isArray(options) && options.some(option => isOptionGroup(option));
/**
* Filters options based on the selected value(s).