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.
-
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.
It only has a single method: parse(url: string) which returns the same string, parsed.
npm install --save shurleyconst shurley = require('shurley');
const parsedUrl = shurley.parse('/example.com');
console.log(parsedUrl); // Outputs 'https://example.com'npm install # installs dependencies
npm test # runs mocha
npm run lint # runs eslint
npm run pretty # runs prettierUpdate the version, run tests, then just run npm publish.