Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

url2

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

url2

Node's URL module plus relative pathing

  • 0.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
22K
decreased by-60.2%
Maintainers
1
Weekly downloads
 
Created
Source

URL2

This module builds upon the existing URL module in NodeJS, but adds relative(source, target) which returns the shortest relative path between any two equally qualified URL’s. If the paths are not equally qualified, it returns the target.

In addition, this package augments the URL object definition as returned by parse and consumed by format.

  • pathname is broken down into
    • root: whether the path is qualified from the root of the domain.
    • relative: the relative path, from the root if pathname is qualified from the domain root.
      • directories: an array of path components
      • file: the name of the file, or null if the URL points to a directory, indicated by a final slash.

Additionally, format uses the path property if it exists, instead of pathname and search.


Based on my earlier work for Narwhal.

Copyright 2012 Kristopher Michael Kowal. All rights reserved. MIT License

Keywords

FAQs

Package last updated on 28 Nov 2012

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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc