A library for query string type coercion
npm install query-parsed
yarn add query-parsed
import queryparse from 'query-parsed';
// Return Type = { test: number }
const parsed = queryparse.parse("test=1", { test: Number });
import queryparse from 'query-parsed';
// Return Type = { test: number[] }
const parsed = queryparse.parse("test=1,2", { test: [Number] }, { arrayFormat: "comma" });
import queryparse from 'query-parsed';
// Return Type = { test: string }
const parsed = queryparse.parse<{ test: string }>("test=1");
import queryparse from 'query-parsed';
// Return Type = Record<string, string | string[]>
const parsed = queryparse.parse("test=1");
String | Boolean | Number