16 lines
445 B
JavaScript
16 lines
445 B
JavaScript
export function hasPathParams(params) {
|
|
return params.some(({ type }) => type === "path")
|
|
}
|
|
|
|
export function addPathParamsToVariables(params, variables) {
|
|
params
|
|
.filter(({ key }) => !!key)
|
|
.filter(({ type }) => type === "path")
|
|
.forEach(({ key, value }) => (variables[key] = value))
|
|
return variables
|
|
}
|
|
|
|
export function getQueryParams(params) {
|
|
return params.filter(({ key }) => !!key).filter(({ type }) => type != "path")
|
|
}
|