linkparse

0.1.0 • Public • Published

linkparse

linkparse


Install

$ npm install --save linkparse

Usage

import linkparse from 'linkparse'

// location.href
// https://www.baidu.com/s?wd=name&rsv_spt=1&rsv_iqid=0xf1866a79000470c3

// get url search item
let wd = linkparse.getItem(window.location.href, 'wd')
// output: "name"

// set url search item
let newUrl = linkparse.setItem(window.location.href, 'age', '23')
// output: "https://www.baidu.com/s?wd=name&rsv_spt=1&rsv_iqid=0xf1866a79000470c3&age=23#"

// remove url search item
let newUrl_1 = linkparse.removeItem(window.location.href, 'rsv_spt')
// output: "https://www.baidu.com/s?wd=name&rsv_iqid=0xf1866a79000470c3#"

Readme

Keywords

Package Sidebar

Install

npm i linkparse

Weekly Downloads

1

Version

0.1.0

License

MIT

Unpacked Size

2.78 kB

Total Files

3

Last publish

Collaborators

  • dengchao2056