Node's Perfect Mate

    typed-qs

    0.1.0 • Public • Published

    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;

    Keywords

    Install

    npm i typed-qs

    DownloadsWeekly Downloads

    1

    Version

    0.1.0

    License

    MIT

    Last publish

    Collaborators

    • jiangfengming