stb-util-parse-query

1.3.0 • Public • Published

Query string parser

NPM version Dependencies Status Gitter

stb-util-parse-query is a module to parse query part of the location URL.

Installation

npm install stb-util-parse-query

Usage

Add to the scope:

var parseQuery = require('stb-util-parse-query');

Parse some parameters:

// gives {param: 'value', another_param: 'another_value'}
console.log(parseQuery('param=value&another_param=another_value'));

Parse current document query string:

console.log(parseQuery(document.location.search.substring(1)));

Debug mode

There is a global var DEBUG which activates additional consistency checks and protection logic not available in release mode.

In debug mode the util method is exposed to the global namespace as window.utilParseQuery.

Contribution

If you have any problem or suggestion please open an issue here. Pull requests are welcomed with respect to the JavaScript Code Style.

License

stb-util-parse-query is released under the GPL-3.0 License.

Package Sidebar

Install

npm i stb-util-parse-query

Weekly Downloads

0

Version

1.3.0

License

GPL-3.0

Last publish

Collaborators

  • mullock