"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = getIdByPathname;

var _path = _interopRequireDefault(require("path"));

var _urlQuery = _interopRequireDefault(require("./url-query"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function getIdByPathname(pathname, base = "/") {
  const parsed = _urlQuery.default.parse(pathname);

  const fragments = (_path.default.posix || _path.default).relative(base, parsed.pathname).split("/");

  const last = fragments.pop();
  return [...fragments, _path.default.basename(last, _path.default.extname(last))].join("/");
}
//# sourceMappingURL=get-id-by-pathname.js.map