Socket
Book a DemoInstallSign in
Socket

aurl

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

aurl

Uniform Resource Locator.

1.2.0
latest
Source
npmnpm
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

URL

spm package Build Status Coverage Status

Uniform Resource Locator.

Usage

var Url = require("url");

var url = new Url("https://www.example.com/path/to/page?pa=A1&pa=A2&pb=B#hash");
console.log(url);
console.log(url.getParam("pa")); // "A1"
console.log(url.getParams("pa")); // ["A1", "A2"]

API

new Url(String url)

Constructor.

  • origin: readonly, and not changed when protocol, hostname, port modified! Until one day most of all browseres supports Object.defineProperty(). Use getOrigin() instead.
  • protocol: read+write.
  • username: read+write.
  • password: read+write.
  • host: readonly, not changed same the origin property. Use getHost() instead.
  • hostname: read+write.
  • port: read+write.
  • path: read+write.
  • search: readonly! Please use setParam(), addParam(), delParam(), and clearParams() method to modify query.
  • hash: read+write.

String getOrigin()

Get the origin info.

String getHost()

Get the host info.

String getParam(String name)

Get named name param string the first.

Array getParams(String name)

Get named name params string of all.

Url delParam(String name)

Delete named name params.

Url addParam(String name, String|Array value)

Add params named name.

Url setParam(String name, String|Array)

Add or replace param values named name.

Url clearParams()

Clear all param datas.

String toString()

Return url string.

Boolean Url.verify(String url)

Static method.

Licenses

MIT

Keywords

utility

FAQs

Package last updated on 11 Nov 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.