Repository navigation
fix(fjl)!: correct concatMap, isSuffixOf, and $assignDeep - #146
Merged
Merged
Conversation
…ssignDeep concatMap now flattens its results by one level, using list/concat. $assignDeep now spreads its rest args, which also fixes $objUnion. BREAKING CHANGE: isSuffixOf and $isSuffixOf now take the needle first, matching isPrefixOf, isInfixOf and isSubsequenceOf. concatMap returns a flattened list, so `fn` must return a list. 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
Three behaviour fixes split out of the #122 review.
concatMapnow flattens. It imported the variadic_platformconcat, soconcatMap(x => [x, x], [1, 2])returned[[1, 1], [2, 2]]. It now returns[1, 1, 2, 2], usinglist/concat, and an empty list still returns[].isSuffixOfand$isSuffixOftake the needle first, matchingisPrefixOf,isInfixOfandisSubsequenceOf. Nothing insrcor the sibling packages calls them.$assignDeepspreads its rest args, so$assignDeep(a)(b, c)mergesbandcrather than the array[b, c].$objUnionis an alias, so it's fixed too.Closes #141
Breaking changes
isSuffixOf(haystack, needle)becomesisSuffixOf(needle, haystack). Old-order calls don't error, and usually just returnfalse.concatMap'sfnmust now return a list, and the return type changes fromRetT[]toRetT. Afnreturning a non-list value now throws.Migration notes are tracked in #142.
Tests
test-concatMapis rewritten, because its old case pinned the unflattened result.test-isSuffixOfis flipped, with two new negative cases.it.failingentries for$assignDeepand$objUnionare now normal tests. TheknownFailureoption in the registry has no remaining users, but I left it in place for future cases.Testing
pnpm test: 133 suites and 1460 tests passnpx tsc --noEmit -p packages/fjl/tsconfig.json: cleanpnpm build: succeeds, and the new behaviour is confirmed againstdist/cjs/index.cjseslinton changed files: clean🤖 Generated with Claude Code