@codecademy/gamut

72.2.272.2.3-alpha.83b0a8.0
dist/Form/SelectDropdown/utils.js
dist/Form/SelectDropdown/utils.jsDeleted
−38
Index: package/dist/Form/SelectDropdown/utils.js
===================================================================
--- package/dist/Form/SelectDropdown/utils.js
+++ package/dist/Form/SelectDropdown/utils.js
@@ -1,38 +0,0 @@
-export const isMultipleSelectProps = props => !!props.multiple;
-export const isSingleSelectProps = props => !props.multiple;
-export const isOptionGroup = obj => obj != null && typeof obj === 'object' && '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).
- * Handles both single values and arrays of values, and works with both
- * flat option arrays and grouped options.
- *
- * @param options - The options to filter from
- * @param value - The value or values to filter by
- * @param optionsAreGrouped - Whether the options are grouped
- * @returns Array of matching options
- */
-export const filterValueFromOptions = (options, value, optionsAreGrouped) => {
-  if (optionsAreGrouped) {
-    return options.map(optionGroup => optionGroup.options.filter(option => option.value === value || value?.includes(option.value))).flat();
-  }
-  return options.filter(option => option.value === value || value?.includes(option.value));
-};
-
-/**
- * Removes a value from the selected options array.
- * Handles both single values and arrays of values to remove.
- *
- * @param selectedOptions - The currently selected options
- * @param value - The value or values to remove
- * @returns New array with the specified values removed
- */
-export const removeValueFromSelectedOptions = (selectedOptions, value) => {
-  return selectedOptions.filter(option => {
-    if (Array.isArray(value)) {
-      return !value.includes(option.value);
-    }
-    return option.value !== value;
-  });
-};
\ No newline at end of file