Git Product home page Git Product logo

express-query-parser's People

Contributors

jackypan1989 avatar kevinroomies avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

softmarshmallow

express-query-parser's Issues

Problem with nested arrays in objects

I have encountered the following case:
filter[id_test][type]=in&filter[id_test][filter][0]=1&filter[id_test][filter][1]=2&filter[id_test][filter][2]=3&filter[id_test][filter][3]=4&filter[id_test][filter][4]=5&filter[id_test][filter][5]=6&filter[id_test][filter][6]=7&filter[id_test][filter][7]=8&filter[id_test][filter][8]=9

Should be parsed to { type: 'in', filter: [1,2,3,4,5,6,7,8,9]},
Instead i get filter: {0:0, 1:1, 2:2, ... 9:9}

Unable to integrate with express inversify-express-utils

Thx for library man.

I have an issue with integration into inversify stack

Code

import queryParser from 'express-query-parser'

    ...
    inversifyExpressServer.setConfig(async (app: express.Application) => {
        ...
        app.use(
            queryParser({
                parseNull: true,
                parseBoolean: true
            })
        )
    });

Error

[2020-11-17T15:51:48.899] [ERROR] main - TypeError: express_query_parser_1.default is not a function
    at ...\backend\typescript\src\App.ts:110:28
    at InversifyExpressServer.build ...\backend\node_modules\inversify-express-utils\lib\server.js:119:28)
    at ...\typescript\src\App.ts:127:41
    at processTicksAndRejections (internal/process/task_queues.js:97:5) (<anonymous> ..\App.ts:99:27)

P.S.

  1. Add github link to npm description plz
  2. Add documentation line about ramda package requirement

empty string is converted to 0

you need to add the if (target === '') { to your code.

export const parse = (target: ParsedQuery, options: Options): ParsedQuery => {
switch (typeof target) {
case 'string':
if (target === '') {
return '';
} else if (options.parseNull && target === 'null') {
return null;

Default behavior

Hey there,
Thanks for useful helper package

Docs says that all options are "true" by default, which means that I can use it like this:

app.use(queryParser());

but I can't because of typescript, and passing empty object resetting options to undefined โ‡พ false

Proposal

Made queryParser argument optional, and set all options to true by default.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.