NVP parser. Like querystring, but for pairs where the name encodes primitive types, objects or arrays.
Install via NPM.
$ npm install nvpqs
Deserialize a NVP query string to an object. Optionally override the default delimiter (.
), separator (&
) and assignment (=
) characters.
const Nvpqs = require('nvpqs');
Nvpqs.parse('a=b&c.d=e&f.0=g'); // { a: 'b', c: { d: 'e' }, f: ['g'] }
Serialize an object to a NVP query string. Optionally override the default delimiter (.
), separator (&
) and assignment (=
) characters.
const Nvpqs = require('nvpqs');
Nvpqs.stringify({ a: 'b', c: { d: 'e' }, f: ['g'] }); // 'a=b&c.d=e&f.0=g'