Attributes
Includes Deno configuration
Repository
Current version released
9 months ago
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:
It doesnāt check if the URL exists, you can do that in many different ways.
It assumes only
httpandhttpsprotocols for URLs.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 shurleyconst 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 testPublishing
After committing and pushing with a new version in deno.json, just run make publish.