(arg: string | string[])
| 22 | } |
| 23 | |
| 24 | export function socketPath(arg: string | string[]) { |
| 25 | const a = copyOrSplit(arg); |
| 26 | // if the argument count is even, the last argument is an id |
| 27 | // Format of properties endpoint is an exception |
| 28 | // and needs to be properties/*, not properties/*/* |
| 29 | const stars = ['*']; |
| 30 | // is it odd? |
| 31 | if (((a.length % 2) === 1) && (a.at(-1) !== "properties")) { |
| 32 | stars.push('*'); |
| 33 | } |
| 34 | return a.concat(stars).join('/'); |
| 35 | } |
| 36 | |
| 37 | export function socketPathRE(socketPath: string) { |
| 38 | return new RegExp(`^${socketPath.replace(/\*/g, "[^/]+")}$`); |
no test coverage detected