1.0.9 • Published 5 months ago

shurley v1.0.9

Weekly downloads
11
License
ISC
Repository
github
Last release
5 months ago

Shurley

npm.io deno npm jsr

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.

Deno

import shurley from 'jsr:@brn/shurley@1.0.9'; // or import shurley from 'https://deno.land/x/shurley@1.0.9/mod.ts';

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

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

Node/NPM

npm install --save-exact shurley
const shurley = require('shurley'); // or import shurley from 'shurley';

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

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

Development

Requires deno.

make format
make test

Publishing

After committing and pushing with a new version in deno.json, just run make publish.

1.0.9

5 months ago

1.0.8

5 months ago

1.0.7

5 months ago

1.0.6

9 months ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.2

3 years ago

1.0.3

3 years ago

1.0.1

5 years ago

1.0.0

6 years ago