Skip to content

New operators#6

Merged
hntrl merged 14 commits intomainfrom
feature/operators
Apr 14, 2025
Merged

New operators#6
hntrl merged 14 commits intomainfrom
feature/operators

Conversation

@hntrl
Copy link
Owner

@hntrl hntrl commented Apr 14, 2025

This introduces 10 new utility operators into eventkit. Most of them are additions that pair with the recently landed singleton observables.

Also fixes the behavior of the reduce operator so that it more closely matches up with it's Array.prototype.reduce counterpart

@changeset-bot
Copy link

changeset-bot bot commented Apr 14, 2025

🦋 Changeset detected

Latest commit: 03fb5d1

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@hntrl hntrl requested a review from Copilot April 14, 2025 23:05
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.

Copilot reviewed 28 out of 28 changed files in this pull request and generated 1 comment.

expect(accumulatorSpy).toHaveBeenNthCalledWith(3, undefined, 3, 2);
expect(accumulatorSpy).toHaveBeenCalledTimes(2);
expect(accumulatorSpy).toHaveBeenNthCalledWith(1, 1, 2, 1);
expect(accumulatorSpy).toHaveBeenNthCalledWith(2, undefined, 3, 2);
Copy link

Copilot AI Apr 14, 2025

Choose a reason for hiding this comment

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

In the no-seed scenario for reduce, the accumulator should use the result of the prior accumulation rather than 'undefined' as the first argument on subsequent calls. Please review the reduce operator implementation to ensure its behavior aligns with Array.prototype.reduce.

Suggested change
expect(accumulatorSpy).toHaveBeenNthCalledWith(2, undefined, 3, 2);
expect(accumulatorSpy).toHaveBeenNthCalledWith(2, 3, 3, 2);

Copilot uses AI. Check for mistakes.
Copy link
Owner Author

Choose a reason for hiding this comment

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

The accumulator function intentionally returns undefined (as apart of the test case). The second call to the accumulator fn should have undefined as its acc value since that was what was returned by the last one, so this should be a non issue.

@hntrl hntrl merged commit eb44738 into main Apr 14, 2025
2 checks passed
@hntrl hntrl deleted the feature/operators branch April 14, 2025 23:09
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