Skip to content

feat[query-string]: add stringify to es-toolkit/query-string - #2121

Merged
dayongkr merged 5 commits into
mainfrom
feat/stringify-search
Oct 10, 2026
Merged

dayongkr merged 5 commits into
mainfrom
feat/stringify-search

Conversation

@dayongkr

@dayongkr dayongkr commented Sep 26, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Adds stringify to a new es-toolkit/query-string entrypoint. It turns an object into ?a=1&b=2, or '' when there is nothing to add.

Proposed in #2111 as stringifySearch in es-toolkit/util. This PR ships it as stringify in a dedicated es-toolkit/query-string entrypoint instead.

import { stringify } from 'es-toolkit/query-string';

`/items${stringify({ page: 1, tags: ['a', 'b'], q: 'hello world', ref: undefined })}`;
// '/items?page=1&tags=a&tags=b&q=hello%20world'

Changes

  • New entrypoint es-toolkit/query-string (exports, files, publishConfig, postbuild root stub, check-dist entrypoint list). It is not re-exported from the main entrypoint.
  • Omits null and undefined, repeats keys for arrays, and encodes with encodeURIComponent.
  • Tests and docs in four languages. The docs sidebar gets a "Query String Utilities" section under the es-toolkit tab.

Input type

T extends object & { [K in keyof T]: QueryValue | readonly QueryValue[] }

  • The mapped type accepts objects declared with interface, which Record<string, …> rejects, and rejects nested objects and Date.
  • object & rejects null and primitives, which the mapped type alone lets through.

@vercel

vercel Bot commented Sep 26, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
es-toolkit Ready Ready Preview Oct 10, 2026 6:14am UTC

Request Review

…as stringify

- Add the es-toolkit/query-string entrypoint (exports, files, publishConfig, postbuild stub, check-dist list).
- Rename stringifySearch to stringify and drop it from es-toolkit/util.
- Move the four docs to reference/query-string and add the Query String Utilities sidebar section.
@dayongkr dayongkr changed the title feat[stringifySearch]: add stringifySearch to es-toolkit/util feat[query-string]: add stringify to es-toolkit/query-string Oct 10, 2026
@dayongkr
dayongkr merged commit 5f0e6b2 into main Oct 10, 2026
12 checks passed

This branch was successfully deployed

1 active deployment
Preview — 974cab70 Deployed Oct 10, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant