@urltools/modify-url
Version:
modify url based on serializable config
18 lines (17 loc) • 521 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var path_1 = require("path");
var modifyPathname = function (type, pathname, value) {
switch (type) {
case 'replace':
return value;
case 'append':
return path_1.resolve(pathname, value);
}
};
var pathname = function (url, config) {
var _a = config, type = _a.type, value = _a.value;
url.pathname = modifyPathname(type, url.pathname, value);
return url;
};
exports.default = pathname;