| 13791 | // (as long as the trailing slash is not immediately preceded by another slash), |
| 13792 | // and add leading slash if missing. |
| 13793 | function normalize$1(path) { |
| 13794 | path = `${path}`; |
| 13795 | let i = path.length; |
| 13796 | if (slash(path, i - 1) && !slash(path, i - 2)) path = path.slice(0, -1); |
| 13797 | return path[0] === "/" ? path : `/${path}`; |
| 13798 | } |
| 13799 | |
| 13800 | // Walk backwards to find the first slash that is not the leading slash, e.g.: |
| 13801 | // "/foo/bar" ⇥ "/foo", "/foo" ⇥ "/", "/" ↦ "". (The root is special-cased |