remove-path-prefix.js 491 B

123456789101112131415
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.removePathPrefix = removePathPrefix;
  6. var _pathHasPrefix = require("./path-has-prefix");
  7. function removePathPrefix(path, prefix) {
  8. if ((0, _pathHasPrefix).pathHasPrefix(path, prefix)) {
  9. const withoutPrefix = path.slice(prefix.length);
  10. return withoutPrefix.startsWith('/') ? withoutPrefix : `/${withoutPrefix}`;
  11. }
  12. return path;
  13. }
  14. //# sourceMappingURL=remove-path-prefix.js.map