blog/themes/fluid/scripts/utils/url-join.js

13 lines
262 B
JavaScript
Raw Normal View History

2024-11-16 11:34:10 +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;