@microsoft/windows-admin-center-sdk
Version:
Microsoft - Windows Admin Center Shell
22 lines (20 loc) • 695 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getRelativePath = void 0;
const tslib_1 = require("tslib");
const path = tslib_1.__importStar(require("path"));
/**
* Gets the relative path from A to B.
* Usage:
* const sourcePath = '/home/user/documents/projectA/';
* const targetPath = '/home/user/images/';
* const relativePath = getRelativePath(sourcePath, targetPath);
* @param pathA path to A
* @param pathB path to B
* @returns
*/
function getRelativePath(pathA, pathB) {
return path.relative(pathA, pathB).replaceAll('\\', '\/').replace('..\/', '');
}
exports.getRelativePath = getRelativePath;
//# sourceMappingURL=relative-path.js.map