samchon / typia

Super-fast/easy runtime validators and serializers via transformation
https://typia.io/
MIT License
4.64k stars 160 forks source link

replace URLSearchParams to IReadableURLSearchParams #1349

Open miyaji255 opened 2 weeks ago

miyaji255 commented 2 weeks ago

I'm using Typia on Hono, because Hono's query is Record<string, string[]>, so I can't use the http module. This PR allow a thin wrapper as query arguments. https://github.com/honojs/hono/blob/main/src/request.ts#L160

Thin wrapper example

const queries = c.req.queries();
const urlSearchParams: IReadableSearchParams = {
   get: queryName => queries[queryName][0] ?? null,
   getAll: queryName => queries[queryName] ?? []
}
pkg-pr-new[bot] commented 2 weeks ago

Open in Stackblitz

npm i https://pkg.pr.new/typia@1349

commit: d00bce8