Refactor (packages/codemode/src/stdlib/collections.ts): Function with many returns - #61
Open
Ahmed120515 wants to merge 1 commit into
Open
Refactor (packages/codemode/src/stdlib/collections.ts): Function with many returns#61Ahmed120515 wants to merge 1 commit into
Ahmed120515 wants to merge 1 commit into
Conversation
Ahmed120515
force-pushed
the
refactor-spread-items
branch
from
September 4, 2026 14:29
b3eecdc to
8e7b133
Compare
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.
Issue for this PR
Closes #59
Type of change
What does this PR do?
This PR reduces the number of returns in
spreadItemsby extracting the sandbox collection cases intospreadSandboxItems.spreadItemsstill handles arrays and strings directly, and the helper handlesSandboxMap,SandboxSet, andSandboxURLSearchParams. Unsupported values still do returnundefined, so the behavior remains the same.I also added a test for spreading
URLSearchParams, since existing tests already covered Map and Set spreading.How did you verify your code works?
qlty smells --no-snippets packages/codemode/src/stdlib/collections.tsreports no smells.bun lint packages/codemode/src/stdlib/collections.ts packages/codemode/test/stdlib.test.tspasses with 0 warnings and 0 errors.bun test test/stdlib.test.tspasses with 69 tests and 0 failures.src/stdlib/collections.ts.packages/web/src/types/lang-map.d.ts.Screenshots / recordings
Before and after Qlty output, passing tests, coverage results, and targeted lint output are attached below.




Checklist