srph-qsdeprecated

Translates your JavaScript object to a URL query.

Usage no npm install needed!

<script type="module">
  import srphQs from 'https://cdn.skypack.dev/srph-qs';
</script>

README

qs.js npm version devDependency Status Build Status SemVer MIT license

Translates object to a query string, and vice-versa. qs.js is a simple library weighing ~2kb.

Installation

  • qs.js is available via [bower]
$ bower install srph-qs --save

* The --save argument persists it to bower.json

  • qs.js is available via [npm]
$ npm install srph-qs --save

* The --save argument persists it to package.json

Usage

var qs = require('srph-qs');

var str = qs.stringify({ first: 'Kier', last: 'Borromeo' }); // => '?first=Kier&last=Borromeo'
var obj = qs.stringify(str); // => { first: 'Kier', last: 'Borromeo' }

Non-node users

If you are not using CommonJS require (or if you've never heard of any of those, you don't have to care), qs.js is exported as UMD.

// For AMD (Require.js)
define(['srph-qs'], function(qs) {
  qs.stringify(...);
});

// For browser-globals (Browser-only):
// Make sure to include the script (<script src="/path/to/qs.js"></script>)
qs.stringify(...);

See the API Documentation.

Contribution

For features or fixes, I would suggest to submit an issue first before submitting a pull request. This avoids closed pull-requests; useless work. Feel free to open an issue for any questions and inquries!

Building

See the Building Documentation (This is for contributors or experienced developers only).

Acknowledgement

qs.js © 2015+, Kier Borromeo (srph). qs.js is released under the MIT license.

srph.github.io  ·  GitHub @srph  ·  Twitter @_srph

Alternatives

This library does not intend to compete with alternative libraries, and also only provide very simple features compared to its alternatives.