Back to packages list

Vals using qs

Description from the NPM package:
A querystring parser that supports nesting and arrays, with a depth limit
1
2
3
4
5
6
export async function getPayloadWhereQuery(query: Record<string, any>) {
const qs = await import("npm:qs");
return qs.stringify({
where: query,
});
}

qs

QS is a pretty old module that you probably shouldn't use but it's still pretty heavily used.

In the very very early days there wasn't a built-in way in JavaScript to parse querystrings. So QS was born. But then, Node.js added a querystring module built-in. Then, JavaScript introduced URLSearchParams, which you should use whenever you want to parse or generate query strings.

1
2
3
4
export let qsExample = (async () => {
const qs = await import("npm:qs");
return qs.parse("?hi=there");
})();
1
Next