(fs, rootPath, targetPath)
| 537 | * @returns {string} location of targetPath relative to rootPath |
| 538 | */ |
| 539 | const relative = (fs, rootPath, targetPath) => { |
| 540 | if (fs && fs.relative) { |
| 541 | return fs.relative(rootPath, targetPath); |
| 542 | } else if (path.posix.isAbsolute(rootPath)) { |
| 543 | return path.posix.relative(rootPath, targetPath); |
| 544 | } else if (path.win32.isAbsolute(rootPath)) { |
| 545 | return path.win32.relative(rootPath, targetPath); |
| 546 | } |
| 547 | throw new Error( |
| 548 | `${rootPath} is neither a posix nor a windows path, and there is no 'relative' method defined in the file system` |
| 549 | ); |
| 550 | }; |
| 551 | |
| 552 | /** |
| 553 | * Returns the joined path. |
no outgoing calls
no test coverage detected