Skip to content

fix: replace String().trim() with optional chaining - #308

Merged
avoidwork merged 1 commit into
mainfrom
fix/string-trim-chaining
Jun 18, 2026
Merged

fix: replace String().trim() with optional chaining#308
avoidwork merged 1 commit into
mainfrom
fix/string-trim-chaining

Conversation

@avoidwork

Copy link
Copy Markdown
Owner

Description

Replace String(existingVariable).trim() with existingVariable?.trim() ?? existingVariable in filesystem and session_search tools. The original pattern performed an unnecessary type coercion before trimming, which could mask null/undefined values.

Type of Change

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactor (no functional changes)
  • Performance improvement
  • CI / build / tooling

Testing

  • Manual verification of both affected files.
  • No functional behavior change — both patterns produce the same result for string inputs.

Coverage

  • 100% line coverage maintained

Checklist

  • npm run lint passes
  • Tests pass with 100% line coverage
  • No forbidden patterns used
  • Conventional Commit style applied

@avoidwork
avoidwork merged commit 71a4f3a into main Jun 18, 2026
3 checks passed
@avoidwork
avoidwork deleted the fix/string-trim-chaining branch June 18, 2026 03:57
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.

1 participant