Skip to content

Error with casters and ) #138

@scare82

Description

@scare82

Hi and sorry for my poor english.
I've a problem with ')' char when i try to force cast with string() or use casters with a custom function.
To reproduce the issue:

  const val = aqp("key1=string(abc))");
  console.log(val);

  const val2 = aqp("key1=stringPers(abc))", {
    casters: {
      stringPers: (val: string) => val,
    },
  });
  console.log(val2);

with '(' char works very well.

A workaround seems to use castParams that works with ')' but fails with ',' (the key is converted in array with $in operator)

To reproduce:

const val3 = aqp("key1=a,b,c,)&key2=abc)", {
    castParams: {
      key1: "string",
      key2: "string",
    },
  });
  console.log(val3);

So i haven't still find a way to cast a key with ')' and ',' to simple string

Thanks for help and compliments for your package, is very useful.

Filippo

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions