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

mini-url

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mini-url

Lightweight isomorphic url parser.

  • 2.1.0
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source


mini-url
API Stability TypeScript NPM Version Downloads Browser Bundle Size

Light weight, universal, URL parser for node and the browser with built in caching.

Installation

npm install mini-url

Example

import { parse, stringify } from 'mini-url'

// Parse a url into an object.
parse('http://host.com:8080/p/a/t/h?query=string#hash')
/* {
    protocol: 'http:',
    host: 'host.com:8080',
    port: '8080',
    hostname: 'host.com',
    hash: '#hash',
    search: '?query=string',
    pathname: '/p/a/t/h',
    href: 'http://host.com:8080/p/a/t/h?query=string#hash'
} */

// Stringify an object into a url string.
stringify({
  protocol: 'http:',
  host: 'host.com:8080',
  hash: '#hash',
  search: '?query=string',
  pathname: '/p/a/t/h'
})
/* http://host.com:8080/p/a/t/h?query=string#hash */

Contributions

  • Use npm test to build and run tests.

Please feel free to create a PR!

Keywords

FAQs

Package last updated on 14 Oct 2017

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