omnivore/packages/web/lib/queryParamParser.ts

13 lines
331 B
TypeScript
Raw Normal View History

2022-02-11 17:24:33 +00:00
export function parseErrorCodes(
query: Record<string, unknown>
): string | undefined {
const errorCodesValue = query.errorCodes
if (typeof errorCodesValue !== 'string') {
return undefined
}
const errorCodes = errorCodesValue.split(',').filter((val) => val)
return errorCodes.length ? errorCodes[0] : undefined
}