Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support iterables in places #90

Closed
wants to merge 10 commits into from
Closed

feat: support iterables in places #90

wants to merge 10 commits into from

Conversation

aleclarson
Copy link
Member

@aleclarson aleclarson commented Jul 7, 2024

Tip

The owner of this PR can publish a preview release by commenting /publish in this PR. Afterwards, anyone can try it out by running pnpm add radashi@pr<PR_NUMBER>.

Summary

  • Add castIterable function
    This returns iterable objects as-is, otherwise returns Object.entries result.
  • Add reduceIterable function
  • Add searchIterable function
  • Refactor the following functions to support any iterable or object:
    1. select
    2. selectFirst
    3. cluster
    4. counting
    5. group

For any code change,

  • Related documentation has been updated, if needed
  • Related tests have been added or updated, if needed
  • Related benchmarks have been added or updated, if needed

Does this PR introduce a breaking change?

No

Bundle impact

Status File Size Difference (%)
M src/array/cluster.ts 303 +191 (+170%)
M src/array/counting.ts 288 +176 (+157%)
M src/array/group.ts 289 +170 (+142%)
M src/array/select.ts 334 +184 (+122%)
M src/array/selectFirst.ts 367 +225 (+158%)
A src/iterable/castIterable.ts 85 +85
A src/iterable/reduceIterable.ts 206 +206
A src/iterable/searchIterable.ts 230 +230

@aleclarson aleclarson force-pushed the feat/iterables branch 2 times, most recently from db107f1 to 0775a84 Compare July 7, 2024 20:17
@aleclarson aleclarson force-pushed the main branch 2 times, most recently from 2154f96 to 6a4b4f6 Compare July 12, 2024 00:23
@aleclarson aleclarson added new feature This PR adds a new function or extends an existing one stage 0: proposed A proposal for a change that is offered for community and team evaluation. labels Jul 13, 2024
@aleclarson aleclarson added this to the v12.3.0 milestone Sep 21, 2024
@aleclarson aleclarson removed the stage 0: proposed A proposal for a change that is offered for community and team evaluation. label Sep 21, 2024
@aleclarson aleclarson added rejected A rejected proposal. and removed new feature This PR adds a new function or extends an existing one labels Nov 20, 2024
@aleclarson aleclarson removed this from the v12.3.0 milestone Nov 20, 2024
@aleclarson aleclarson added the open library This PR should be listed in the Open Library label Nov 20, 2024
@aleclarson aleclarson closed this Nov 20, 2024
@aleclarson
Copy link
Member Author

Closing this, as I decided it's easy enough to use Array.from or Object.entries. The performance impact is negligible for the large majority of use cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
open library This PR should be listed in the Open Library rejected A rejected proposal.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant