@umdjs/query-string v1.0.0
UMD build dist for query-string.
English ・ 简体中文 ・ Changelog · Report Bug · Request Feature
📦 Usage
[!NOTE]\ The @umdjs/query-string only provides UMD dist of query-string.
Add script
tag in your browser and use the global variable queryString
.
We provide dist files under dist folder in @umdjs/query-string's npm package. You can also download these files directly from or unpkg.
<!doctype html>
<html lang="zh-CN">
<head>
<script src="//unpkg.com/@umdjs/query-string/dist/index.min.js" />
</head>
<body>
<script>
console.log(location.search);
//=> '?foo=bar'
// ~ Use `queryString` from global:
const parsed = queryString.parse(location.search);
console.log(parsed);
//=> {foo: 'bar'}
console.log(location.hash);
//=> '#token=bada55cafe'
const parsedHash = queryString.parse(location.hash);
console.log(parsedHash);
//=> {token: 'bada55cafe'}
parsed.foo = 'unicorn';
parsed.ilike = 'pizza';
const stringified = queryString.stringify(parsed);
//=> 'foo=unicorn&ilike=pizza'
location.search = stringified;
// note that `location.search` automatically prepends a question mark
console.log(location.search);
//=> '?foo=unicorn&ilike=pizza'
</script>
</body>
</html>
⌨️ Local Development
You can use Github Codespaces for online development:
Or clone it for local development:
git clone https://github.com/Carrotzpc/umdjs.git
cd umdjs
pnpm install
pnpm dev
🗒️ Changelog
See query-string/CHANGELOG.md for detail.
🤝 Contributing
Contributions of all types are more than welcome, if you are interested in contributing code, feel free to check out our GitHub Issues to get stuck in to show us what you’re made of.
📝 License
Copyright © 2024 Carrotzpc. This project is MIT licensed.
1 year ago
1 year ago