(path: string, rootLength: number)
| 145 | }; |
| 146 | |
| 147 | const pathComponents = (path: string, rootLength: number) => { |
| 148 | const root = path.substring(0, rootLength); |
| 149 | const rest = path.substring(rootLength).split('/'); |
| 150 | const restLen = rest.length; |
| 151 | if (restLen > 0 && !rest[restLen - 1]) { |
| 152 | rest.pop(); |
| 153 | } |
| 154 | return [root, ...rest]; |
| 155 | }; |
| 156 | |
| 157 | /** |
| 158 | * Same as normalizePath(), expect it'll also strip any query strings |