js-http-build-query

1.1.0 • Public • Published

js-http-build-query

Created Badge Created Badge Created Badge

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:

$ npm i js-http-build-query

Usage:

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

Security Vulnerabilities

If you discover a security vulnerability or bugs, please send an e-mail to Muhaimenul Islam via i.muhaimen@gmail.com.

License

The js-http-build-query package is open-sourced project licensed under the MIT license.

Package Sidebar

Install

npm i js-http-build-query

Weekly Downloads

7

Version

1.1.0

License

MIT

Unpacked Size

3.9 kB

Total Files

4

Last publish

Collaborators

  • muhaimenul