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

mergeScan()'s accumulator doesn't receive any index parameter #4441

Closed
martinsik opened this issue Dec 29, 2018 · 0 comments
Closed

mergeScan()'s accumulator doesn't receive any index parameter #4441

martinsik opened this issue Dec 29, 2018 · 0 comments
Labels
feature PRs and issues for features

Comments

@martinsik
Copy link
Contributor

martinsik commented Dec 29, 2018

Bug Report

Current Behavior
When using mergeScan() its accumulator function never receives index like all other operators.

https:/ReactiveX/rxjs/blob/master/src/internal/operators/mergeScan.ts#L48

Reproduction

mergeScan((acc, v, index) => {
  // index will be always `undefined`
}, null)

Expected behavior
The accumulator function should receive index parameter with ever increasing numbers for every emission from source like scan or mergeMap do.

https:/ReactiveX/rxjs/blob/master/src/internal/operators/mergeMap.ts#L13
https:/ReactiveX/rxjs/blob/master/src/internal/operators/scan.ts#L7

Environment

  • Runtime: all
  • RxJS version: 6.3.3
martinsik added a commit to martinsik/rxjs that referenced this issue Jan 8, 2019
@benlesh benlesh added the feature PRs and issues for features label Jan 16, 2019
benlesh pushed a commit that referenced this issue Jan 30, 2019
* feat(mergeScan): add index to the accumulator function

Closes #4441

* test(mergeScan): use marbles instead of "of()"

* test(mergeScan): update spec, remove unnecessary dtest

* readd index lost in merge.
@lock lock bot locked as resolved and limited conversation to collaborators Mar 1, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature PRs and issues for features
Projects
None yet
Development

No branches or pull requests

2 participants