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

uriemitter

v0.0.2

Published

Emit URI schemes with callbacks.

Downloads

3

Readme

URIEmitter (v0.0.2)

Install: npm install uriemitter

This project is Unlicensed. In other words, I don't care what you do with it. However, if you make something interesting, I would like to check it out.

Scheme Objects:

NOTE: "anchor" is now "fragment" in the result object.

Scheme V1: <scheme>://<host>[:<port>][/<path>][?<query>][#<fragment>]
Scheme V2: <scheme>:<path>[?<query>][#<fragment>*]

Scheme V1 Object: link, scheme, auth, host, port, path, query, fragment
Scheme V2 Object: link, scheme, path, query, fragment*

   * Fragment is unlikely, but matches them anyway.

Functions:

Examples in `./examples/` folder.

URIEmitter.on(<scheme>,<callback>) - Add a listener for <scheme>. Used with `URIEmitter.emit(<scheme>,<scheme object>)`. No return.

     Examples: URIEmitter.on('http',function (data) { console.log(data); });
               URIEmitter.on('foo',function (data) { console.log(data); });

URIEmitter.once(<scheme>,<callback>) - Same as URIEmitter.on, only called once. No return.

URIEmitter.multi(<schemes>,<callback>[,<once>]) - Add multiple schemes in an array. If <once> is true, only emit once. No return.

     Examples: URIEmitter.multi(['http','foo'],function (data) { console.log(data); }); // No return.

URIEmitter.emit(<scheme>,<scheme object>) - Emits a scheme. See "Scheme Objects" for more information.

URIEmitter.parse(<str>) - Check to see if <str> matches one of the URI regexes. Returns scheme object or null.

     Examples: console.log(URIEmitter.parse('http://example.com/')); // <V1 OBJECT>
               console.log(URIEmitter.parse('[email protected]:LouisT/URIEmitter.git')); // <V2 OBJECT>;

URIEmitter.check(<string>[,<emit>]) - Check if <string> is a URI. Returns Boolean. If <emit> is passed, emit found scheme.

     Examples: URIEmitter.check('http://example.com',true); // true
               URIEmitter.check('This: is a test string.',true); // false

URIEmitter.scan(<string>[,<emit>]) - Check if <string> has a URI within it. Returns number of URIs found. If <emit> is passed,
                                     emit any schemes found.

     Examples: URIEmitter.scan('This is a test. http://example.com/ -- [email protected]:LouisT/URIEmitter.git',true) // 2
               URIEmitter.scan('This is another test.',true) // 0

TODO:

  • [ ] Add browser support.
  • [ ] Write a better README.
  • [ ] Make better examples.
  • [ ] Write a better TODO.