https://github.com/brunobernardino/shurley
I'll give you the right URL, but don't call me Shirley!
https://github.com/brunobernardino/shurley
deno javascript jsr npm package typescript url-parser
Last synced: 6 days ago
JSON representation
I'll give you the right URL, but don't call me Shirley!
- Host: GitHub
- URL: https://github.com/brunobernardino/shurley
- Owner: BrunoBernardino
- License: mit
- Created: 2020-01-05T19:07:15.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2025-02-02T14:27:33.000Z (3 months ago)
- Last Synced: 2025-04-14T08:46:18.644Z (14 days ago)
- Topics: deno, javascript, jsr, npm, package, typescript, url-parser
- Language: TypeScript
- Homepage: https://jsr.io/@brn/shurley
- Size: 64.5 KB
- Stars: 8
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# Shurley
[](https://github.com/BrunoBernardino/shurley/actions?workflow=Run+Tests) [](https://deno.land/x/shurley) [](https://www.npmjs.com/package/shurley) [](https://jsr.io/@brn/shurley)
> I'll give you the right URL, but [don't call me Shirley!](https://www.youtube.com/watch?v=ixljWVyPby0)
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
```ts
import shurley from 'jsr:@brn/[email protected]'; // or import shurley from 'https://deno.land/x/[email protected]/mod.ts';const parsedUrl = shurley.parse('example.com');
console.log(parsedUrl); // Outputs 'https://example.com'
```### Node/NPM
```bash
npm install --save-exact shurley
``````js
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`.
```bash
make format
make test
```## Publishing
After committing and pushing with a new version in `deno.json`, just run `make publish`.