Skip to content

feat: add find as an alias for filter#79

Open
mcabreradev wants to merge 6 commits intomainfrom
feat/find-alias
Open

feat: add find as an alias for filter#79
mcabreradev wants to merge 6 commits intomainfrom
feat/find-alias

Conversation

@mcabreradev
Copy link
Owner

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

  • ✨ New feature
  • 🛠️ Bug fix
  • ❌ Breaking change
  • 🧹 Code refactor
  • 📝 Documentation
  • 🗑️ Chore

Changes Made

  • List specific changes
  • Include technical details
  • Mention any breaking changes

Testing

  • Unit tests added/updated
  • Type tests added/updated
  • Integration tests added/updated
  • All tests pass locally

Documentation

  • Documentation updated
  • Examples added/updated
  • API reference updated

Checklist

  • Code builds successfully
  • No TypeScript errors
  • No linter issues
  • Follows coding standards

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>
@vercel
Copy link

vercel bot commented Mar 18, 2026

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

Project Deployment Actions Updated (UTC)
filter Ready Ready Preview, Comment Mar 18, 2026 8:04pm

@mcabreradev mcabreradev requested a review from Copilot March 18, 2026 19:42
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 find from core and the main index as an alias for filter.
  • Rename the main entry point’s lazy-iterator find export to lazyFind.
  • 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.

Comment on lines 21 to 31
export {
take,
skip,
map,
reduce,
toArray,
forEach,
every,
some,
find,
find as lazyFind,
chunk,
Comment on lines +304 to +324
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 }),
);
});
});
mcabreradev and others added 3 commits March 18, 2026 16:48
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>
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 find from src/core and the root entrypoint as an alias of filter.
  • Rename the root export of the lazy-iterator find helper to lazyFind.
  • 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.

Comment on lines +43 to +54
- **`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.
Comment on lines 1 to 3
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>
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 findAll as an exported alias of filter from core and the main package entrypoint.
  • Update unit tests and tsd type tests to cover findAll.
  • Update README and docs (quick start, API reference, changelog) to document findAll and clarify the difference vs the lazy-iterator find.

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.

Comment on lines +105 to +106
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’;
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