Skip to content

Conversation

@DaBestCode
Copy link

This PR adds support for dividing an iterable/async iterable into evenly sized chunks while preserving order. Implements the following methods:

transform.divide()

transform.divideAsync()

Stream.divide()

AsyncStream.divide()

Example Usage

Stream.of([1, 2, 3, 4]).divide(2).toArray(); 
// => [[1, 2], [3, 4]]

for await (const chunk of AsyncStream.of([1, 2, 3, 4]).divide(2)) {
  console.log(chunk); 
}
// Logs: [1, 2], then [3, 4]

Details

transform.divide: generator function that splits a synchronous iterable/iterator into n smaller arrays.

transform.divideAsync: async generator function that splits an asynchronous iterable/iterator into n smaller arrays.

Stream.divide: integrates transform.divide into the Stream class.

AsyncStream.divide: integrates transform.divideAsync into the AsyncStream class. #75 

@Smoren Smoren changed the base branch from master to dev August 31, 2025 13:27
@Smoren
Copy link
Owner

Smoren commented Aug 31, 2025

Hi @DaBestCode! Please rebase your branch from dev and push it to fix github workflows.

@DaBestCode DaBestCode force-pushed the feature/transform-divide branch from 8b8d5bd to 9d01b34 Compare August 31, 2025 18:22
@DaBestCode
Copy link
Author

Hi @Smoren I have rebased and pushed the branch. Can you check if it passes the workflows.

@Smoren
Copy link
Owner

Smoren commented Aug 31, 2025

Hi @DaBestCode! Please fix issues in the review.

@DaBestCode
Copy link
Author

Hi @Smoren I am so sorry I am fixing it. Please bare with me.

@DaBestCode
Copy link
Author

@Smoren if you dont mind can you run this. I have removed the incorrect imports.

@Smoren
Copy link
Owner

Smoren commented Sep 2, 2025

Hi @DaBestCode
Please add tests for all the new features in this PR, add docs to README and extend the CHANGLOG.md.

@Smoren
Copy link
Owner

Smoren commented Sep 6, 2025

Hi @DaBestCode
There is a lot of formatting changes in README and CHANGELOG files. Can you roll back these changes please?
And please resolve the conflicts.

@DaBestCode DaBestCode force-pushed the feature/transform-divide branch from a8437a6 to 3569498 Compare September 6, 2025 20:25
@Smoren
Copy link
Owner

Smoren commented Dec 29, 2025

Hi @DaBestCode Can you please rebase your branch from master and resolve the conflicts?

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