Files
explore/lib/getFilterValueFromQuery.ts
T
2023-02-24 12:37:08 -05:00

6 lines
272 B
TypeScript

export default function getFilterValue<FilterType>(filterValues: ReadonlyArray<FilterType>, val: string | Array<string> | undefined): FilterType | undefined {
if (typeof val === 'string' && filterValues.includes(val as FilterType)) {
return val as FilterType;
}
}