path-has-prefix.js 439 B

123456789101112131415
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.pathHasPrefix = pathHasPrefix;
  6. var _parsePath = require("./parse-path");
  7. function pathHasPrefix(path, prefix) {
  8. if (typeof path !== 'string') {
  9. return false;
  10. }
  11. const { pathname } = (0, _parsePath).parsePath(path);
  12. return pathname === prefix || pathname.startsWith(prefix + '/');
  13. }
  14. //# sourceMappingURL=path-has-prefix.js.map