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

shurley

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

shurley

Validate or fix URLs from user input. People make mistakes!

  • 1.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
18
increased by20%
Maintainers
1
Weekly downloads
 
Created
Source

Shurley

I'll give you the right URL, but don't call me Shirley!

Parses URLs from user input (with potential typos in protocols, bad copy+paste, etc.) and returns a proper URL.

It has no dependencies, and it's meant to be this simple.

Some things to note:

  1. It doesn't check if the URL exists, you can do that in many different ways.

  2. It assumes only http and https protocols for URLs.

  3. If there's a "mistake" in the URL protocol, it defaults to https.

Usage

It only has a single method: parse(url: string) which returns the same string, parsed.

npm install --save shurley
const shurley = require('shurley');

const parsedUrl = shurley.parse('/example.com');

console.log(parsedUrl); // Outputs 'https://example.com'

Development

npm install  # installs dependencies
npm test  # runs mocha
npm run lint  # runs eslint
npm run pretty  # runs prettier

Publishing

Update the version, run tests, then just run npm publish.

Keywords

FAQs

Package last updated on 15 Mar 2020

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