Skip to content

fix(fjl)!: correct concatMap, isSuffixOf, and $assignDeep - #146

Merged
elycruz merged 1 commit into
mainfrom
141-behaviour-fixes
Nov 3, 2026
Merged

elycruz merged 1 commit into
mainfrom
141-behaviour-fixes

Conversation

@elycruz

@elycruz elycruz commented Nov 3, 2026

Copy link
Copy Markdown
Member

Summary

Three behaviour fixes split out of the #122 review.

  • concatMap now flattens. It imported the variadic _platform concat, so concatMap(x => [x, x], [1, 2]) returned [[1, 1], [2, 2]]. It now returns [1, 1, 2, 2], using list/concat, and an empty list still returns [].
  • isSuffixOf and $isSuffixOf take the needle first, matching isPrefixOf, isInfixOf and isSubsequenceOf. Nothing in src or the sibling packages calls them.
  • $assignDeep spreads its rest args, so $assignDeep(a)(b, c) merges b and c rather than the array [b, c]. $objUnion is an alias, so it's fixed too.

Closes #141

Breaking changes

  • isSuffixOf(haystack, needle) becomes isSuffixOf(needle, haystack). Old-order calls don't error, and usually just return false.
  • concatMap's fn must now return a list, and the return type changes from RetT[] to RetT. A fn returning a non-list value now throws.

Migration notes are tracked in #142.

Tests

  • test-concatMap is rewritten, because its old case pinned the unflattened result.
  • test-isSuffixOf is flipped, with two new negative cases.
  • The it.failing entries for $assignDeep and $objUnion are now normal tests. The knownFailure option in the registry has no remaining users, but I left it in place for future cases.

Testing

  • pnpm test: 133 suites and 1460 tests pass
  • npx tsc --noEmit -p packages/fjl/tsconfig.json: clean
  • pnpm build: succeeds, and the new behaviour is confirmed against dist/cjs/index.cjs
  • eslint on changed files: clean

🤖 Generated with Claude Code

…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>
@elycruz
elycruz merged commit 1def5a5 into main Nov 3, 2026
3 checks passed
@elycruz
elycruz deleted the 141-behaviour-fixes branch November 3, 2026 16:13
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.

fix(fjl): v2.0 behaviour fixes for concatMap, isSuffixOf, and $assignDeep

1 participant