How to use the urijs.defaultPorts function in urijs

To help you get started, we’ve selected a few urijs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github passy / node-dom-urls / index.js View on Github external
get origin() {
    // "Let uri-scheme be the scheme component of the URI,
    // converted to lowercase."
    var scheme = this._url.protocol().toLowerCase();

    var hostname = this._url.hostname().toLowerCase();

    var port = '';
    if (this._url._parts.port !== null &&
        this._url._parts.port !== URI.defaultPorts[this._url.protocol()]) {
      port = ':' + this._url.port();
    }

    return scheme + '://' + hostname + port;
  }
};