typed-qs
v0.1.0
Published
URL query string with support of boolean, number and null.
Downloads
7
Readme
typedQs
URL query string with support of boolean, number and null.
in browser:
var query = typedQs.encode({
category: 'book',
showUsedItem: false,
limit: 20,
keyword: null
}};
// /list?category=book&showUsedItem=!false&limit=!20&keyword=!null
$.get('/list', query).then(function(result) {
console.log(result);
});
node.js:
var url = require('url');
var typedQs = require('typed-qs');
var urlInfo = url.parse(req.url, true);
var query = typedQs.decode(urlInfo.query);
query.category === 'book';
query.showUsedItem === false;
query.limit === 20;
query.keyword === null;