Skip to content

xesam/js-parse-url

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@xesam/url

Parse url-style string with pure RegExp.

npm install @xesam/url

Usage

const url = require('@xesam/url'); // commonjs
//import url from '@xesam/url'; // es module

const comps = url('https://admin:root@xesam.github.io:80/abc/def?name=xesam#fragment?a=b#c=d');
console.log(comps);

Output:

{
    protocol: 'https:',
    auth: 'admin:root',
    host: 'xesam.github.io:80',
    hostname: 'xesam.github.io.cn',
    port: '80',
    pathname: '/abc/def',
    search: '?name=xesam',
    query: 'name=xesam',
    hash: '#fragment?a=b#c=d'
}

About

Parse url-style string with pure RegExp.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published