Repository navigation
refactor(fjl)!: move find* and reduce* out of list/utils - #145
Merged
Merged
Conversation
…out of list/utils find, findIndex, findIndices, foldl and foldr now hold the real implementations. reduce and reduceRight stay public as aliases of foldl and foldr. reduceUntil and reduceUntilRight move to list/ under the same names. The other utils stay in list/utils. BREAKING CHANGE: findWhere, findIndexWhere and findIndicesWhere, and their $ forms, are removed; use find, findIndex and findIndices. findIndexWhereRight is renamed to findLastIndex. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Every
find*andreduce*pair shipped under two names, with the real code inlist/utils. This makes the public modules the real implementations.findWherefindis the implementationfindIndexWherefindIndexis the implementationfindIndicesWherefindIndicesis the implementationfindIndexWhereRightfindLastIndex, inlist/findLastIndex.tsfoldl = reducefoldlis the implementation;reduce = foldlfoldr = reduceRightfoldris the implementation;reduceRight = foldrlist/utils/reduceUntil*list/reduceUntil*, same namesThe
$forms follow the same changes. The other utils (slice*,lastIndex,lengths,toShortest,swap,genericAscOrdering) stay inlist/utils.Closes #83
Breaking changes
The four
*Wherenames and their$forms are gone from the public API. No sibling package uses them. Migration notes are tracked in #142.Tests
find*andreduce*tests moved fromtests/list-utils/totests/list/.test-findWhereandtest-findIndexWhereare merged intotest-findandtest-findIndex.test-findIndicesWhereis deleted because it duplicatedtest-findIndices.findLastIndexcase with duplicate matches, since the old cases only used unique values and couldn't tell which end the search started from.tests/test-currying.tsregistry updated. The expected curried method count goes from 109 to 108 (111 exports minus the 3 removed).Testing
pnpm test: 130 suites and 1445 tests pass. That's 12 fewer tests than before, because the duplicate suite and the removed$forms are gone.npx tsc --noEmit -p packages/fjl/tsconfig.json: cleanpnpm build: succeeds. Checked againstdist/cjs/index.cjs: the removed names are gone, the new and kept names are present, and the aliases are the same functions asfoldlandfoldr.eslinton changed files: no errors, and 4 unused-import warnings that were already in the moved test files🤖 Generated with Claude Code