Skip to content

fix(clean): strip surrounding whitespace#125

Merged
jan-kubica merged 1 commit into
mainfrom
fix/compact-strip-surrounding-whitespace
Jun 13, 2026
Merged

fix(clean): strip surrounding whitespace#125
jan-kubica merged 1 commit into
mainfrom
fix/compact-strip-surrounding-whitespace

Conversation

@jan-kubica

Copy link
Copy Markdown
Contributor

clean() normalizes Unicode artifacts and removes the separator characters it is given, but left surrounding whitespace outside that set (newlines, tabs) intact. Since every compact() — and therefore every validate() — builds on clean(), a value padded with a stray newline or tab (common in copy-paste) failed the length/format checks and was wrongly rejected.

A few modules already worked around this with a manual .trim() in their compact; most did not, so the behavior was inconsistent across jurisdictions.

This trims in clean() so every compact()/validate() handles surrounding whitespace uniformly. Internal characters and the existing separator-stripping are unchanged.

Added a focused clean unit test and an end-to-end no.orgnr case; the full suite passes.

clean() normalized unicode and removed the given separator characters but left surrounding whitespace outside that set (newlines, tabs) intact, so validate() rejected otherwise-valid copy-pasted input. A few modules worked around this with a manual .trim(); most did not.

Trim in clean() so every compact()/validate() handles surrounding whitespace uniformly.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the clean utility function in src/_util/clean.ts to trim surrounding whitespace (such as newlines and tabs) from the output, ensuring that validators can handle copy-pasted input with trailing or leading whitespace. It also adds corresponding unit tests in __test__/clean.test.ts and __test__/no.test.ts to verify this behavior. There are no review comments, so no additional feedback is provided.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@jan-kubica jan-kubica merged commit 2dae4c0 into main Jun 13, 2026
9 checks passed
@jan-kubica jan-kubica deleted the fix/compact-strip-surrounding-whitespace branch June 13, 2026 19:56
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 13, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant