cjs-query
v1.5.1
Published
Parse the given location search string into object.
Downloads
19
Maintainers
Readme
Query string handler
Module to parse query part of the location URL.
Installation
npm install cjs-query
Usage
Add to the scope:
var query = require('cjs-query');
Parse some parameters:
// gives {param: '5000', another_param: 'another_value'}
// note that the type of param value is string
console.log(query.parse('param=5000&another_param=another_value'));
Parse current document query string:
console.log(query.parse(document.location.search.substring(1)));
Stringify query params:
// gives 'param=128'
console.log(query.stringify({param: 128}));
Contribution
If you have any problems or suggestions please open an issue according to the contribution rules.
License
cjs-query
is released under the MIT License.