(path)
| 611 | }, |
| 612 | |
| 613 | dirname(path) { |
| 614 | if (path.length === 0) return "." |
| 615 | let code = path.charCodeAt(0) |
| 616 | const hasRoot = code === 47 /*/*/ |
| 617 | let end = -1 |
| 618 | let matchedSlash = true |
| 619 | for (let i = path.length - 1; i >= 1; --i) { |
| 620 | code = path.charCodeAt(i) |
| 621 | if (code === 47 /*/*/) { |
| 622 | if (!matchedSlash) { |
| 623 | end = i |
| 624 | break |
| 625 | } |
| 626 | } else { |
| 627 | // We saw the first non-path separator |
| 628 | matchedSlash = false |
| 629 | } |
| 630 | } |
| 631 | |
| 632 | if (end === -1) return hasRoot ? "/" : "." |
| 633 | if (hasRoot && end === 1) return "//" |
| 634 | return path.slice(0, end) |
| 635 | }, |
| 636 | |
| 637 | basename(path, ext) { |
| 638 | let start = 0 |
no outgoing calls
no test coverage detected