Skip to content

refactor: replace trim() helper with native String.prototype.trim()#557

Merged
remarkablemark merged 1 commit into
masterfrom
refactor/trim
Jul 6, 2026
Merged

refactor: replace trim() helper with native String.prototype.trim()#557
remarkablemark merged 1 commit into
masterfrom
refactor/trim

Conversation

@remarkablemark

Copy link
Copy Markdown
Owner

What is the motivation for this pull request?

Refactor: remove the polyfill-era trim() helper function in favor of the native String.prototype.trim(), which has been universally available since IE9 and Node.js v0.1.

What is the current behavior?

A custom trim() helper wraps str.replace(/^\s+|\s+$/g, '') with a falsy guard, along with a comment referencing the MDN polyfill.

What is the new behavior?

The trim() helper and TRIM_REGEX are removed. Call sites now use str.replace(COMMENT_REGEX, '').trim() directly.

Checklist:

@codecov

codecov Bot commented Jul 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (08faa75) to head (3a56de8).

Additional details and impacted files
@@            Coverage Diff            @@
##            master      #557   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            1         1           
  Lines          100        97    -3     
  Branches        17        16    -1     
=========================================
- Hits           100        97    -3     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@remarkablemark remarkablemark changed the title refactor: replace trim() helper with native String.prototype.trim() refactor: replace trim() helper with native String.prototype.trim() Jul 6, 2026
@remarkablemark remarkablemark self-assigned this Jul 6, 2026
@mergify

mergify Bot commented Jul 6, 2026

Copy link
Copy Markdown

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

@remarkablemark remarkablemark merged commit c549d50 into master Jul 6, 2026
13 checks passed
@remarkablemark remarkablemark deleted the refactor/trim branch July 6, 2026 05: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.

1 participant