mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 10:45:47 +00:00
30 lines
612 B
JavaScript
30 lines
612 B
JavaScript
(function(scope) {
|
|
'use strict';
|
|
|
|
var Scope = scope.window ? window : global,
|
|
|
|
PREFIX = '/join';
|
|
|
|
if (typeof module === 'object' && module.exports)
|
|
module.exports = join;
|
|
else
|
|
Scope.join = join;
|
|
|
|
function join (prefix, names) {
|
|
var url;
|
|
|
|
if (!names) {
|
|
names = prefix;
|
|
prefix = PREFIX;
|
|
}
|
|
|
|
|
|
if (!names)
|
|
throw(Error('names must be array!'));
|
|
|
|
url = prefix + ':' + names.join(':');
|
|
|
|
return url;
|
|
}
|
|
|
|
})(this);
|