Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ojoi-web): Categories page #16762

Merged
merged 13 commits into from
Nov 11, 2024
Merged
28 changes: 28 additions & 0 deletions apps/web/components/OfficialJournalOfIceland/OJOIUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,31 @@ export const formatDate = (date?: string, df = 'dd.MM.yyyy') => {
throw new Error(`Could not format date: ${date}`)
}
}

export const getStringArrayFromQueryString = (
jonbjarnio marked this conversation as resolved.
Show resolved Hide resolved
value?: string | string[],
): string[] => {
if (!value) {
return []
}

if (Array.isArray(value)) {
return value
}

return value.split(',')
}

export const getStringFromQueryString = (
value?: string | string[],
): string | undefined => {
if (!value) {
return undefined
}

if (Array.isArray(value)) {
return value[0]
}

return value
}
Loading
Loading