2015-11-12 00:26:15 +00:00
|
|
|
'use strict';
|
|
|
|
|
2015-11-21 20:47:28 +00:00
|
|
|
module.exports.getDomainInfo = function (instancename) {
|
|
|
|
var parts = instancename.split(/[#%]+/);
|
2015-11-12 00:26:15 +00:00
|
|
|
var hostname = parts.shift();
|
2015-11-12 11:14:59 +00:00
|
|
|
var pathname = parts.join('/').replace(/\/+/g, '/').replace(/\/$/g, '').replace(/^\//g, '');
|
2015-11-12 00:26:15 +00:00
|
|
|
|
|
|
|
return {
|
|
|
|
hostname: hostname
|
|
|
|
, pathname: pathname
|
|
|
|
, dirpathname: parts.join('#')
|
2015-11-21 20:47:28 +00:00
|
|
|
, dirname: instancename
|
|
|
|
, isRoot: instancename === hostname
|
2015-11-12 00:26:15 +00:00
|
|
|
};
|
|
|
|
};
|