hexo-theme-ayer/scripts/utils/join-path.js
2021-05-24 11:28:56 +08:00

13 lines
264 B
JavaScript

'use strict';
const joinPath = function(base, relative) {
if (relative && /^https*:\/\//.test(relative)) {
return relative;
}
return relative
? base.replace(/\/+$/, '') + '/' + relative.replace(/^\/+/, '')
: base;
};
module.exports = joinPath;