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

index accumulates when addIndex is put inside pipe #85

Closed
ywchan2005 opened this issue Nov 29, 2018 · 1 comment
Closed

index accumulates when addIndex is put inside pipe #85

ywchan2005 opened this issue Nov 29, 2018 · 1 comment

Comments

@ywchan2005
Copy link

when addIndex is composed by pipe

const foo = R.pipe(
  R.addIndex(R.map)((x, idx) => x+'-'+idx),
)

indices (i.e. idx) received are correct in the first call

console.log(foo(['a', 'b', 'c', 'd']))
// => ['a-0', 'b-1', 'c-2', 'd-3']

however, indices seem to accumulate in the second call

console.log(foo(['a', 'b']))
// => ['a-4', a-5']

and also in later calls

const result = foo(['a', 'b', 'c'])
// => ['a-6', 'b-7', 'c-8']

sample code

@selfrefactor
Copy link
Owner

selfrefactor commented Nov 29, 2018

So this method addIndex is not added by me, rather than from a contributor. As much I can see, I cannot solve it in simple way, so I will go and remove it.

New version will be published in the coming days, so you still have time to suggest solution and in this case the new version will contain your code.

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

No branches or pull requests

2 participants