walnut.js/lib/utils.js

16 lines
405 B
JavaScript
Raw Permalink Normal View History

'use strict';
2015-11-21 20:47:28 +00:00
module.exports.getDomainInfo = function (instancename) {
var parts = instancename.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('#')
2015-11-21 20:47:28 +00:00
, dirname: instancename
, isRoot: instancename === hostname
};
};