2020-05-02 17:34:16 +00:00
|
|
|
export function hasPathParams(params) {
|
2020-06-11 14:25:40 +00:00
|
|
|
return params.some(({ type }) => type === "path")
|
2020-05-02 17:34:16 +00:00
|
|
|
}
|
2020-06-11 14:25:40 +00:00
|
|
|
|
2020-05-02 17:34:16 +00:00
|
|
|
export function addPathParamsToVariables(params, variables) {
|
2020-06-11 14:25:40 +00:00
|
|
|
params
|
|
|
|
|
.filter(({ key }) => !!key)
|
|
|
|
|
.filter(({ type }) => type === "path")
|
|
|
|
|
.forEach(({ key, value }) => (variables[key] = value))
|
|
|
|
|
return variables
|
2020-05-02 17:34:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function getQueryParams(params) {
|
2020-06-11 14:25:40 +00:00
|
|
|
return params.filter(({ key }) => !!key).filter(({ type }) => type != "path")
|
|
|
|
|
}
|