Files
explore/lib/getFilterValueFromQuery.ts
T
2022-12-13 16:55:41 +03:00

6 lines
270 B
TypeScript

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