Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/0xch4z/query-str
A lightweight, independent micro-library for parsing/generating URL query strings.
https://github.com/0xch4z/query-str
javascript json parsing query-string url-parameters
Last synced: 19 days ago
JSON representation
A lightweight, independent micro-library for parsing/generating URL query strings.
- Host: GitHub
- URL: https://github.com/0xch4z/query-str
- Owner: 0xch4z
- License: mit
- Created: 2017-07-03T05:25:54.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-05-29T06:16:13.000Z (over 5 years ago)
- Last Synced: 2024-10-16T03:31:18.705Z (about 1 month ago)
- Topics: javascript, json, parsing, query-string, url-parameters
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/query-str
- Size: 18.6 KB
- Stars: 2
- Watchers: 1
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
query-str
Parse and stringify URL query strings with ease. 🚀
## Installation ⬇️
```bash
$ npm install --save query-str
```
API Usage 📝
-----
### Parse query string with URL
```js
const qs = require('query-str');const myURL = 'http://foo.bar/buzz?myBool=true&myInt=2&myFloat=3.3&myString=fizz%20buzz';
qs.parse(myURL);
// => { myBool: true, myInt: 2, myFloat: 3.3, myString: 'fizz buzz' }
```### Parse query string
```js
const qs = require('query-str');const myURL = 'isOpenSource=true&isPassing=true&codacyScore=10.0';
qs.parse(myURL);
// => { isOpenSource: true, isPassing: true, codacyScore: 10.0 }
```### Stringify parameter object with URL
```js
const qs = require('query-str');const myURL = 'https://foo.bar/buzz';
const myParams = {
fin: false,
bazz: 22
};qs.stringify(myParams, myURL);
// => 'https://foo.bar/buzz?fin=false&bazz=22'
```### Stringify parameter object
```js
const qs = require('query-str');const myParams = {
myBool: false,
myInt: 6,
myFloat: 3.3,
myString: 'fin fun'
};qs.stringify(myParams);
// => '?myBool=false&myInt=6&myFloat=3.3&myString=fin%20fun'
```