Skip to content

refactor(compat/every): rename 'source' param to 'collection'#1844

Open
Antoliny0919 wants to merge 2 commits into
toss:mainfrom
Antoliny0919:rename-compat-every-param
Open

refactor(compat/every): rename 'source' param to 'collection'#1844
Antoliny0919 wants to merge 2 commits into
toss:mainfrom
Antoliny0919:rename-compat-every-param

Conversation

@Antoliny0919

Copy link
Copy Markdown
Contributor

No description provided.

@vercel

vercel Bot commented Jul 6, 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 9, 2026 12:08am

Request Review

@Antoliny0919

Copy link
Copy Markdown
Contributor Author
export function every<T>(
  source: ArrayLike<T> | Record<any, any> | null | undefined,
  doesMatch?: ((item: T, index: number, arr: any) => unknown) | Partial<T> | [keyof T, unknown] | PropertyKey,
  guard?: unknown
):
스크린샷 2026-07-06 오후 9 46 25

The parameter name used in the doesMatch documentation doesn't match the one used in the implementation signature. Would it make sense to standardize this as well (arr -> collection)?

@raon0211

raon0211 commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

Agreed, I think it makes sense to standardize this as you suggested — using collection and doesMatch consistently across the signature and docs.

@Antoliny0919

Copy link
Copy Markdown
Contributor Author

Thank you @raon0211

Agreed, I think it makes sense to standardize this as you suggested — using collection and doesMatch consistently across the signature and docs.

I agree as well, it seems like the docs should switch to doesMatch too.

Also, to add to what I asked earlier, I don't think my intent came across clearly, so let me clarify:

my-think

For one of the doesMatch types, ((item: T, index: number, collection: any) => unknown), the docs use collection for the third parameter, but the code uses arr.
What I was actually asking was whether we should unify this to collection :)

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.

2 participants