walnut.js/lib/utils.js

16 lines
385 B
JavaScript
Raw Normal View History

'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, '');
return {
hostname: hostname
, pathname: pathname
, dirpathname: parts.join('#')
, dirname: apppath
, isRoot: apppath === hostname
};
};