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(collections/unstable): Iterable argument in chunk() #5925

Merged
merged 3 commits into from
Sep 23, 2024

Conversation

Liam-Tait
Copy link
Contributor

@Liam-Tait Liam-Tait commented Sep 9, 2024

Create an unstable version of collections chunk()

This version supports both arrays and iterables. The existing implementation for arrays is essentially a branch in this new api for two reasons.

  • Chunk previously counted empty array values as an part of the chunk, removing this and chunking by non-empty values would make this a breaking change. There is a test case for this.
  • The array implementation is generally faster (did some benchmarking locally) which IMO is likely the common use of this api.

#5470

Copy link

codecov bot commented Sep 9, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.24%. Comparing base (b3e1ebb) to head (a39f46c).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5925      +/-   ##
==========================================
- Coverage   96.25%   96.24%   -0.01%     
==========================================
  Files         489      489              
  Lines       39457    39463       +6     
  Branches     5824     5827       +3     
==========================================
+ Hits        37980    37983       +3     
- Misses       1433     1436       +3     
  Partials       44       44              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Liam-Tait Liam-Tait changed the title feat(collections): support Iterable in chunk() feat(collections): support Iterable argument in chunk() Sep 9, 2024
@Liam-Tait Liam-Tait marked this pull request as ready for review September 10, 2024 10:51
@Liam-Tait Liam-Tait marked this pull request as draft September 19, 2024 13:18
@Liam-Tait Liam-Tait marked this pull request as ready for review September 21, 2024 07:43
@kt3k kt3k changed the title feat(collections): support Iterable argument in chunk() feat(collections/unstable): Iterable argument in chunk() Sep 23, 2024
Copy link
Member

@kt3k kt3k left a comment

Choose a reason for hiding this comment

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

Thanks for updating! LGTM

@kt3k kt3k merged commit 4209011 into denoland:main Sep 23, 2024
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants