Skip to content

feat: iterable aware firstValue / head helper - #1918

Open
hazrid93 wants to merge 1 commit into
toss:mainfrom
hazrid93:hazrid93/70_1796
Open

feat: iterable aware firstValue / head helper#1918
hazrid93 wants to merge 1 commit into
toss:mainfrom
hazrid93:hazrid93/70_1796

Conversation

@hazrid93

Copy link
Copy Markdown

Closes #1796.

Add firstValue(iterable) that pulls a single value via the iterator protocol (Symbol.iterator().next().value), returning the first value of any iterable (arrays, sets, maps, generators, strings) or undefined if empty. Lazy: does not consume the rest of the iterable.

@vercel

vercel Bot commented Jul 20, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
es-toolkit Ready Ready Preview, Comment Jul 20, 2026 11:16am

Request Review

Closes toss#1796.

Add firstValue(iterable) that pulls a single value via the iterator protocol (Symbol.iterator().next().value), returning the first value of any iterable (arrays, sets, maps, generators, strings) or undefined if empty. Lazy: does not consume the rest of the iterable.
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.

Feature request: add an iterable-aware firstValue / head helper

1 participant