https://github.com/muhaimenul/js-http-build-query
A JavaScript package to generate HTTP Query String from Object
https://github.com/muhaimenul/js-http-build-query
http javascript query-string url
Last synced: about 20 hours ago
JSON representation
A JavaScript package to generate HTTP Query String from Object
- Host: GitHub
- URL: https://github.com/muhaimenul/js-http-build-query
- Owner: muhaimenul
- License: mit
- Created: 2019-12-09T14:23:54.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2022-05-29T13:18:21.000Z (over 3 years ago)
- Last Synced: 2024-08-09T05:50:15.969Z (over 1 year ago)
- Topics: http, javascript, query-string, url
- Language: JavaScript
- Homepage: https://npm.io/package/js-http-build-query
- Size: 69.3 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# js-http-build-query
[](https://npm.io/package/js-http-build-query)
[](https://npm.io/package/js-http-build-query)
[](https://npm.io/package/js-http-build-query)
A simple JavaScript package to generate URL-encoded HTTP Query String. Just create a object using query parameters and their values, and pass the object through this module to build query string (like `http_build_query()` in php).
## Installation:
```bash
$ npm i js-http-build-query
```
## Usage:
```javascript
const http_build_query = require('js-http-build-query')
// Simple object
let data = {
roll: 143,
message: 'hello world',
url: 'https://example.com'
}
http_build_query(data) // roll=143&message=world&url=https://example.com
let complexData = {
foo: "bar",
items: {
salt: "suger",
quantity: [2, 3, 4]
}
}
http_build_query(complexData) // foo=bar&items[salt]=suger&items[quantity][0]=2&items[quantity][1]=3&items[quantity][2]=4
```
## Contributing
[Muhaimenul Islam](https://github.com/muhaimenul)
## Security Vulnerabilities
If you discover a security vulnerability or bugs, please send an e-mail to Muhaimenul Islam via [i.muhaimen@gmail.com](mailto:i.muhaimen@gmail.com).
## License
The js-http-build-query package is open-sourced project licensed under the [MIT license](https://opensource.org/licenses/MIT).