resolve-tspaths
Version:
Transform path mappings in your compiled Typescript code
19 lines (18 loc) • 529 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.normalizePath = normalizePath;
/**
* Normalize paths to resolve issues with paths on Windows.
*
* @see https://github.com/benyap/resolve-tspaths/pull/20
* @see https://github.com/benyap/resolve-tspaths/pull/174
*
* @param path The path to normalize.
*/
function normalizePath(path) {
return path
.replace(/^\\\\\?\\/, "")
.replace(/\\/g, "/")
.replace(/\/\/+/g, "/")
.replace(/^.\/\.\.\//g, "../");
}