qrystr-parse-170615

0.1.6 • Public • Published

qrystr-parse-170615

Reduced version of qrystr: Takes the minimalism further for cases where you only need decoding of very simple QS.

  • "very simple QS" includes treating …&flag&… the same as …&flag=&…, i.e. as an empty string value. If you want true instead, use the qrystr module.

Still too large a library? You might not need any at all: URLSearchParams are now widely supported.

Usage

from test/all.js:

var refQSmod = require('querystring'),
  pqs = require('qrystr-parse-170615'),
  slim = require('qrystr-parse-170615/slim');

function verify(qs) {
  var ex = ((typeof qs === 'string') && refQSmod.parse(qs));
  if (!ex) {
    ex = qs;
    qs = refQSmod.stringify(ex);
  }
  eq(pqs(qs), ex);
  eq(slim(qs), ex);
}

verify({ hello: 'world', '23': '42', 'úmlæütè': 'µ¶§°¹²³±' });

Known issues

  • Needs more/better tests and docs.

 

License

ISC

Readme

Keywords

Package Sidebar

Install

npm i qrystr-parse-170615

Weekly Downloads

1

Version

0.1.6

License

ISC

Last publish

Collaborators

  • mk-pmb