1
0
Fork 0
mirror of https://gitlab.com/bramw/baserow.git synced 2025-04-22 12:22:24 +00:00
bramw_baserow/web-frontend/modules/builder/utils/path.js
2023-04-11 13:41:43 +00:00

16 lines
510 B
JavaScript

export const VALID_PATH_CHARACTERS =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~:/?#[]@!$&'()*+,;=".split(
''
)
// This regex needs to be matching PATH_PARAM_REGEX in the backend
// (baserow / contrib / builder / pages / constants.py)
export const PATH_PARAM_REGEX = /(:[A-Za-z0-9_]+)/g
export const ILLEGAL_PATH_SAMPLE_CHARACTER = '^'
export function getPathParams(path) {
return [...path.matchAll(PATH_PARAM_REGEX)].map((pathParam) =>
pathParam[0].substring(1)
)
}