hexo/node_modules/hexo-theme-fluid/scripts/utils/url-join.js

13 lines
274 B
JavaScript
Raw Normal View History

2023-10-03 11:14:36 +08:00
'use strict';
const urlJoin = function(base, relative) {
if (relative && /^https*:\/\//.test(relative)) {
return relative;
}
return relative
? base.replace(/\/+$/, '') + '/' + relative.replace(/^\/+/, '')
: base;
};
module.exports = urlJoin;