npm.io
0.14.0 • Published 4 years ago

@totebox/query

Licence
MIT
Version
0.14.0
Deps
0
Size
14 kB
Vulns
0
Weekly
0
Stars
4

@totebox/query

安装

npm i @totebox/query

使用

import Query from '../src/index';

const query = Query(url);
query.add({ country: 'china' }).href(); // ...?country=china&...

API

Query([url]) => query

url 不传默认为 location.href

query.values() => querys object
query.add(values = {}) => query
query.remove(querys) => query

querys: String | Array,url 中要移除的 query 的 key

query.has(querys) => Boolean

querys: String | Array,url 中要匹配的 query 的 key,如果是数组,必须全部匹配

query.href() => url

License

MIT nicolaszhao