Javascript pathjoin(/urljoin) + merge object

Date: 2018-03-06
var mergeOptions = (a, b) => {
    var c = {};
    var at;
    for (at in a) {
        if (a.hasOwnProperty(at)) {
            c[at] = a[at];
        }
    }
    for (at in b) {
        if (b.hasOwnProperty(at)) {
            c[at] = b[at];
        }
    }
    return c;
};

var pathJoin = function() {
    var r = [].slice.call(arguments).map(function(s, i, a) {
        s = String(s);
        if(i != 0 && s.charAt(0) == '/') s = s.substr(1);
        if(i != a.length-1 && s.charAt(s.length-1) == '/') s = s.slice(0, -1);
        return s;
    });
    return r.join('/');
};

 

10400cookie-checkJavascript pathjoin(/urljoin) + merge object