You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The text was updated successfully, but these errors were encountered:
lukasbuenger
changed the title
Iterable.reduce takes null as firstReduction if explicitly given.
Iterable.reduce takes null as firstReduction if explicitly given.
Dec 22, 2016
What happened
I wrote a super simple higher order function for
List.reduce
in order for reduce to be composable in a Ramda context:With this style, if I wanted to concat a list of strings, according to the docs I'd simply have to explicitly give the
null
asfirstReduction
:From the docs:
Turns out, that
null
(orundefined
for what it's worth) is still passed asinitialReduction
which leads to unwanted behavior or even to errors.Cause of error
https://github.com/facebook/immutable-js/blob/master/src/IterableImpl.js#L206
The check on L206 only takes the number of passed arguments into account, otherwise blindly assigns
reduction = firstReduction
(L209).Possible solutions
a. Fix the docs
b. Fix the check
How to reproduce
Premise
Cases
The text was updated successfully, but these errors were encountered: