remove-page-path-tail.js 547 B

123456789101112131415
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.removePagePathTail = removePagePathTail;
  6. var _normalizePathSep = require("./normalize-path-sep");
  7. function removePagePathTail(pagePath, options) {
  8. pagePath = (0, _normalizePathSep).normalizePathSep(pagePath).replace(new RegExp(`\\.+(?:${options.extensions.join('|')})$`), '');
  9. if (options.keepIndex !== true) {
  10. pagePath = pagePath.replace(/\/index$/, '') || '/';
  11. }
  12. return pagePath;
  13. }
  14. //# sourceMappingURL=remove-page-path-tail.js.map