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

unuri

v1.1.0

Published

Typescript library for managing URIs, ensuring they meet RFC 3986 standards. Features include parsing, validating, and normalizing URIs, with support for custom schemes.

Downloads

22

Readme

unuri

npm version npm downloads bundle JSDocs

An RFC 3986 compliant, scheme extendable URI parsing, serializing and resolving library for both node and the browser.

This project is a based of uri-js and aims to modernize it and extend it with new schemas/features.

The project is meant to be used by Zamical to parse and validate URIs in compliance with the ICalendar specifications in RFC 5545

Features

  • Compliant with the following RFCs:
    • RFC 3986 Uniform Resource Identifier (URI): Generic Syntax
    • RFC 3987 Internationalized Resource Identifiers (IRIs)
    • RFC 5890 Internationalized Domain Names for Applications (IDNA): Definitions and Document Framework
    • RFC 5952 A Recommendation for IPv6 Address Text Representation
    • RFC 6874 Representing IPv6 Zone Identifiers in Address Literals and Uniform Resource Identifiers (URIs)
  • Supports the following schemes:
  • Scheme extendable
  • Resolve
  • Parse
  • Serialize
  • Normalize

Install

npm install unuri

Usage

Import

import * URI from 'unuri';
import { parse, serialize, resolve, resolveComponents, normalize, equal, removeDotSegments, pctEncChar, pctDecChars, escapeComponent, unescapeComponent } from "unuri";

Parse

const uri = URI.parse('uri://user:[email protected]:123/one/two.three?q1=a1&q2=a2#body');
console.log({ uri }); // scheme: 'uri', userinfo: 'user:pass', host: 'example.com', port: 123, path: '/one/two.three', query: 'q1=a1&q2=a2', fragment: 'body', reference: 'uri' }

Resolve

const base = 'uri://a/b/c/d;p?q';
const uri = URI.resolve(base, '../../g'); // uri://a/g

Serialize

const toSerialize = {
  scheme: 'uri',
  userinfo: 'foo:bar',
  host: 'example.com',
  port: 1,
  path: 'path',
  query: 'query',
  fragment: 'fragment',
}
uri.serialize(toSerialize); // uri://foo:[email protected]:1/path?query#fragment

Normalize

URI.normalize('//192.068.001.000'); // //192.68.1.0

Extend

TODO

Roadmap

The following feature will be added in the future. Any help is appreciated.

  • [x] port all tets to Vitest
  • [ ] refactor the code to be more modular and possibly tree-shakeable
  • [ ] turn the URI into a class
  • [ ] make parsing as static methods
  • [ ] create schema specific classes that extend the URI class
  • [ ] create schema detector
  • [ ] add validation functions
  • [ ] add parseSecure which will throw an error if the URI invalid

The following schemas are not supported yet, but may be needed in the future. Any help is appreciated.

  • [ ] Add support for ftp scheme
  • [ ] Add support for file scheme
  • [ ] Add support for data scheme
  • [ ] Add support for tel scheme

License

Original Work License

The original work in this project is licensed under the following license:

Copyright 2011 Gary Court. All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1.	Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2.	Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY GARY COURT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GARY COURT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

The views and conclusions contained in the software and documentation are those of the authors and should not be interpreted as representing official policies, either expressed or implied, of Gary Court.

Modifications License

The modifications made to this project are licensed under the MIT License, as follows:

Modifications Copyright Notice and MIT License

Copyright (c) (2023) WhiteRock. All rights reserved. <https://github.com/whiterocktech>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

When using or redistributing this project, you may choose to follow either the BSD License for the original work or the MIT License for the subsequent modifications, in compliance with the terms set forth in each license.