JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 92697
  • Score
    100M100P100Q209184F
  • License MIT

DOM URLs for Node

Package Exports

  • dom-urls

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (dom-urls) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Node DOM URLs

Build Status Code Climate Analytics

A partial implementation of the W3C URL Spec Draft for Node building on top of URIjs.

If you find incompatibilities, please report them. Error handling is currently very different from the spec.

Browser Polyfills

Installation

npm install dom-urls

Example

var URL = require('dom-urls');

var url = new URL('relative', 'http://example.com/sub/');

url.protocol; // 'http:'
url.hostname; // 'example.com'
url.pathname; // '/sub/relative/'

url.host = 'example.net:8080';
url.port; // '8080'

Why urijs instead of url?

I tried it first, but Node's own URL module doesn't propagate changes, so changing the host doesn't affect the port and vice-versa and I didn't want to reimplement all of that myself.