8000 fix: honor reduced values in reduceBy transducers by abhinavrastogi2627 · Pull Request #3584 · ramda/ramda · GitHub
[go: up one dir, main page]

Skip to content

fix: honor reduced values in reduceBy transducers - #3584

Open
abhinavrastogi2627 wants to merge 1 commit into
ramda:masterfrom
abhinavrastogi2627:fix/reduceby-transducer-short-circuit
Open

abhinavrastogi2627 wants to merge 1 commit into
ramda:masterfrom
abhinavrastogi2627:fix/reduceby-transducer-short-circuit

Conversation

@abhinavrastogi2627
Copy link
Copy Markdown

reduceBy documents that its value reducer can return R.reduced to stop iteration. Ordinary calls honor that signal, but transduced calls store the reduced wrapper as a group value and keep consuming input. Depending on the reducer, this either exposes the wrapper in the output or throws on the next input.

Honor the reduced signal before recording the triggering value. Stop input consumption while allowing the transducer's normal completion phase to flush previously accumulated groups. This matches ordinary reduceBy, including preserving an existing group and omitting a group first encountered at the stopping input.

Add six regression cases covering into and transduce, stopping in a new or existing group, immediate termination, and which input values were visited.

Validation:

  • All six new regression cases fail on the original code.
  • Node 22.23.2: npm test passes (1,270 tests and lint); npm run build passes.
  • Node 14.21.3 in the official Linux Docker image: npm test passes (1,268 tests, two existing regex-feature skips, and lint).
  • git diff --check passes.

@github-actions
github-actions Bot commented Nov 3, 2026
Copy link
Copy Markdown
Coverage Summary
> ramda@0.32.0 coverage:summary
> BABEL_ENV=cjs nyc --reporter=text-summary mocha -- --reporter=min --require @babel/register

�[2J�[1;3H
1264 passing (884ms)


=============================== Coverage summary ===============================
Statements   : 94.22% ( 2574/2732 )
Branches     : 86.33% ( 1017/1178 )
Functions    : 93.57% ( 568/607 )
Lines        : 94.48% ( 2414/2555 )
================================================================================

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.

1 participant

0