Conversation
Export find from core and main index with identical signature and behavior. Rename the lazy-iterator find to lazyFind in the main index to avoid conflict. Update docs (README, API reference, quick-start, changelog) to document the new alias. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull request overview
This PR introduces a new find export as an alias of the core filter function, and resolves a naming conflict by renaming the existing lazy-iterator find export from the main entry point to lazyFind. It also updates docs and adds tests to cover the new alias.
Changes:
- Export
findfrom core and the main index as an alias forfilter. - Rename the main entry point’s lazy-iterator
findexport tolazyFind. - Update docs and add unit/type tests for the new alias.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/index.ts | Re-exports find from core; renames utils find export to lazyFind. |
| src/core/index.ts | Re-exports find from the core filter module. |
| src/core/filter/index.ts | Re-exports find from filter.ts. |
| src/core/filter/filter.ts | Implements find as an alias to filter. |
| docs/project/changelog.md | Adds a 5.9.0 changelog entry describing the new alias. |
| docs/guide/quick-start.md | Updates import examples to include find and adds a tip explaining the alias. |
| docs/api/reference.md | Documents find as a core API alias for filter. |
| test/test-d/filter.test-d.ts | Adds tsd type assertions for find. |
| test/filter.test.ts | Adds unit tests verifying find matches filter. |
| README.md | Updates changelog section and highlights the new find alias. |
You can also share your feedback on Copilot code review. Take the survey.
| export { | ||
| take, | ||
| skip, | ||
| map, | ||
| reduce, | ||
| toArray, | ||
| forEach, | ||
| every, | ||
| some, | ||
| find, | ||
| find as lazyFind, | ||
| chunk, |
__test__/filter.test.ts
Outdated
| describe('find alias', () => { | ||
| it('returns same results as filter', () => { | ||
| expect(find(data, 'Berlin')).toEqual(filter(data, 'Berlin')); | ||
| }); | ||
|
|
||
| it('works with object expression', () => { | ||
| const city = 'Berlin'; | ||
| expect(find(data, { city })).toEqual(filter(data, { city })); | ||
| }); | ||
|
|
||
| it('works with predicate function', () => { | ||
| const pred = (item: (typeof data)[0]) => item.city === 'Berlin'; | ||
| expect(find(data, pred)).toEqual(filter(data, pred)); | ||
| }); | ||
|
|
||
| it('works with options', () => { | ||
| expect(find(data, 'berlin', { caseSensitive: false })).toEqual( | ||
| filter(data, 'berlin', { caseSensitive: false }), | ||
| ); | ||
| }); | ||
| }); |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
…n path The rename of the lazy-iterator find export to lazyFind is a breaking public API change. Add explicit breaking change notices, migration snippets, and full lazyFind API docs to README, changelog, and API reference so consumers know exactly what changed and how to update. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Adds a find export as an eager alias for the existing filter API (same signature/behavior) while renaming the root-level lazy-iterator find helper to lazyFind to avoid an export name conflict. This fits the codebase’s goal of providing both eager array filtering and lazy iterable utilities under a consistent public API.
Changes:
- Export
findfromsrc/coreand the root entrypoint as an alias offilter. - Rename the root export of the lazy-iterator
findhelper tolazyFind. - Update docs and add unit + type tests for the new alias.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/index.ts | Exposes find from core and aliases lazy-iterator find to lazyFind at the root export surface. |
| src/core/index.ts | Re-exports find from the core filter module. |
| src/core/filter/index.ts | Re-exports find alongside filter from the filter module. |
| src/core/filter/filter.ts | Implements find as a direct alias of filter. |
| docs/project/changelog.md | Documents the new find alias and the lazyFind rename/migration notes. |
| docs/guide/quick-start.md | Updates quick-start imports and adds a note about find being an alias. |
| docs/api/reference.md | Documents find (alias) and lazyFind (iterable helper) and clarifies the difference. |
| test/test-d/filter.test-d.ts | Adds type assertions for find (core filter alias). |
| test/filter.test.ts | Adds runtime tests asserting find matches filter behavior. |
| README.md | Updates changelog section and introduces find alias note + migration guidance. |
You can also share your feedback on Copilot code review. Take the survey.
docs/project/changelog.md
Outdated
| - **`find` lazy helper renamed to `lazyFind`**: Previously, the `find` export from the main entry point was a lazy-iterator helper with a different signature and behavior. That helper has been renamed to `lazyFind`, and `find` now aliases `filter` instead. | ||
| - If you relied on the old lazy `find`, update your imports and calls: | ||
| ```typescript | ||
| // Before 5.9.0 (lazy iterator helper) | ||
| import { find } from '@mcabreradev/filter'; | ||
| const iterator = find(users, { active: true }); // lazy iterator | ||
|
|
||
| // From 5.9.0 onwards | ||
| import { lazyFind } from '@mcabreradev/filter'; | ||
| const iterator = lazyFind(users, { active: true }); // same lazy behavior as old find | ||
| ``` | ||
| - The new `find` export matches `filter`’s eager, array-returning behavior and signature. Use `lazyFind` when you need lazy iteration, and `find`/`filter` for eager filtering. |
| import { expectType, expectError } from 'tsd'; | ||
| import { filter } from '../../src/core/filter'; | ||
| import { filter, find } from '../../src/core/filter'; | ||
| import type { FilterOptions } from '../../src/types'; |
find (lazy-iterator helper, returns T | undefined) is kept unchanged. findAll is introduced as the zero-breaking-change alias for filter. Update all tests, type tests, and docs accordingly. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR introduces a new eager filtering alias (findAll) alongside the existing filter API, and updates tests + documentation to surface the new export across the package entrypoints.
Changes:
- Add
findAllas an exported alias offilterfrom core and the main package entrypoint. - Update unit tests and
tsdtype tests to coverfindAll. - Update README and docs (quick start, API reference, changelog) to document
findAlland clarify the difference vs the lazy-iteratorfind.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/index.ts | Re-exports findAll from core at the main entrypoint. |
| src/core/index.ts | Adds findAll to core barrel exports. |
| src/core/filter/index.ts | Re-exports findAll from the filter module. |
| src/core/filter/filter.ts | Implements findAll as an alias of filter. |
| docs/project/changelog.md | Documents the new alias in the changelog. |
| docs/guide/quick-start.md | Updates import examples and adds a tip explaining findAll. |
| docs/api/reference.md | Adds an API reference section for findAll and clarifies find semantics. |
| test/test-d/filter.test-d.ts | Adds type-level assertions for findAll. |
| test/filter.test.ts | Adds runtime unit tests verifying findAll matches filter. |
| README.md | Mentions findAll and updates changelog anchors/version headings. |
You can also share your feedback on Copilot code review. Take the survey.
| export const findAll = filter; | ||
|
|
| ### Added | ||
| - **`findAll`**: Zero-breaking-change alias for `filter` — identical signature and behavior. The existing `find` lazy-iterator helper (returns `T | undefined`) is untouched. | ||
| ```typescript | ||
| import { findAll } from ‘@mcabreradev/filter’; |
Export find from core and main index with identical signature and behavior. Rename the lazy-iterator find to lazyFind in the main index to avoid conflict.
Update docs (README, API reference, quick-start, changelog) to document the new alias.
Description
Brief description of changes
Type of Change
Changes Made
Testing
Documentation
Checklist