hexo-theme-ayer/scripts/utils/join-path.js

13 lines
264 B
JavaScript
Raw Permalink Normal View History

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