2015-11-12 00:26:15 +00:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
module.exports.getDomainInfo = function (apppath) {
|
|
|
|
var parts = apppath.split(/[#%]+/);
|
|
|
|
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('#')
|
|
|
|
, dirname: apppath
|
|
|
|
, isRoot: apppath === hostname
|
|
|
|
};
|
|
|
|
};
|