UNPKG

crocser

Version:

Fast, lightweight, tinny url parser

62 lines (45 loc) 1.08 kB
# Crocser ## Fast 🚀, lightweight 🎈, tinny URL parser I think there are a million similar solutions, but this one takes no more than 5kb and is easy to use ![illustration](./.assets/crocs.jpg) ### Install ⚙️ ```bash $ npm install crocser # or $ yarn add crocser # or $ pnpm install crocser ``` ### Basic example : ```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"]] } ``` ### For contributors 💻: #### How to start ? 1. Write your logic 2. Write test ```bash $ pnpm run test ``` ![illustration](./.assets/test.png) 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!!!