universal-url

WHATWG URL for Node & Browser.

MIT 4 个版本
安装
npm install universal-url
yarn add universal-url
pnpm add universal-url
bun add universal-url
README

universal-url NPM Version Build Status Dependency Monitor

WHATWG URL for Node & Browser.

  • For Node.js versions >= 8, the native implementation will be used.
  • For Node.js versions < 8, a shim will be used.
  • For web browsers without a native implementation, the same shim will be used.

Installation

Node.js >= 6 is required. To install, type this at the command line:

npm install universal-url

Usage

const {URL, URLSearchParams} = require('universal-url');

const url = new URL('http://domain/');
const params = new URLSearchParams('?param=value');

Global shim:

require('universal-url').shim();

const url = new URL('http://domain/');
const params = new URLSearchParams('?param=value');

Browserify/etc

The bundled file size of this library can be large for a web browser. If this is a problem, try using universal-url-lite in your build as an alias for this module.

版本列表
2.0.0 2018-11-28
1.0.1 2018-08-01
1.0.0-alpha 2017-04-21
1.0.0 2017-06-29