npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

aurl

v1.2.0

Published

Uniform Resource Locator.

Downloads

20

Readme

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