Skip to content

refactor: simplify slice cut/trim prefix/suffix functions#787

Merged
samber merged 1 commit intosamber:masterfrom
d-enk:simplify-cut/trim-prefix/suffix
Jan 27, 2026
Merged

refactor: simplify slice cut/trim prefix/suffix functions#787
samber merged 1 commit intosamber:masterfrom
d-enk:simplify-cut/trim-prefix/suffix

Conversation

@d-enk
Copy link
Contributor

@d-enk d-enk commented Jan 27, 2026

  • CutPrefix now uses HasPrefix instead of manual comparison loop
  • CutSuffix now uses HasSuffix instead of manual comparison loop
  • TrimPrefix simplified with HasPrefix condition in for loop
  • TrimSuffix simplified with HasSuffix condition in for loop

This reduces code duplication and improves readability.

- CutPrefix now uses HasPrefix instead of manual comparison loop
- CutSuffix now uses HasSuffix instead of manual comparison loop
- TrimPrefix simplified with HasPrefix condition in for loop
- TrimSuffix simplified with HasSuffix condition in for loop

This reduces code duplication and improves readability.
@codecov
Copy link

codecov bot commented Jan 27, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.26%. Comparing base (8211383) to head (cd48bc5).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #787      +/-   ##
==========================================
+ Coverage   94.18%   94.26%   +0.07%     
==========================================
  Files          18       18              
  Lines        2873     2860      -13     
==========================================
- Hits         2706     2696      -10     
+ Misses        151      149       -2     
+ Partials       16       15       -1     
Flag Coverage Δ
unittests 94.26% <100.00%> (+0.07%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 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.

@samber samber merged commit b6d1bf3 into samber:master Jan 27, 2026
11 checks passed
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.

2 participants