parent
271b33eaf7
commit
1248a5e14e
1 changed files with 13 additions and 0 deletions
@ -0,0 +1,13 @@ |
|||||||
|
const getQueryParam = ( |
||||||
|
queryParam?: string | string[], |
||||||
|
{ |
||||||
|
fallbackValue = '', |
||||||
|
joinSeparator = '', |
||||||
|
limit = 1, |
||||||
|
}: { fallbackValue?: string; joinSeparator?: string; limit?: number } = {}, |
||||||
|
): string => |
||||||
|
queryParam instanceof Array |
||||||
|
? queryParam.slice(0, limit).join(joinSeparator) |
||||||
|
: queryParam ?? fallbackValue; |
||||||
|
|
||||||
|
export default getQueryParam; |
Loading…
Reference in new issue