UNPKG

@urltools/modify-url

Version:
18 lines (17 loc) 521 B
"use strict"; 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;