import { Option , OptionGroups } from '../../types' ; import { isOptionsType } from '../../utils' ; const flattenOptions = ( options ) : Option [ ] => { if ( isOptionsType ( options ) ) { return options ; } return Object . values ( options ) . reduce ( ( result , optionList ) => result . concat ( optionList ) , [ ] ) ; } ; export default flattenOptions ;