crocser
Version:
Fast, lightweight, tinny url parser
62 lines (45 loc) • 1.08 kB
Markdown
I think there are a million similar solutions, but this one takes no more than 5kb and is easy to use

```bash
$ npm install crocser
$ yarn add crocser
$ pnpm install crocser
```
```javascript
import { parseUrl } from 'crocser'
const info = parseUrl('https://vk.com/im?sel=c901')
console.log(info)
```
Then send a request:
```json
{
"protocol": "https",
"hostname": "vk.com",
"subdomain": "",
"domain": "vk.com",
"domainWithoutSuffix": "vk",
"publicSuffix": "com",
"queryParamsResult": [["sel", "c901"]]
}
```
1. Write your logic
2. Write test
```bash
$ pnpm run test
```

if tests passed :
1. Create your feature branch (`git checkout -b my-new-feature`)
2. Commit your changes (`git commit -am 'Add some feature'`)
3. Push to the branch (`git push origin my-new-feature`)
4. Create new Pull Request
5. ???
6. PROFIT!!!