fix: implement missing utilities and correct edge-case bugs - #299
Open
stooit wants to merge 1 commit into
Open
Conversation
- calculator: divide now throws on zero divisor instead of returning Infinity - string-utils: wordCount collapses consecutive whitespace; implement truncate with word-boundary cut and ellipsis counted toward maxLength - task-manager: implement remove, update (partial-safe), and sortBy (priority/status/createdAt) - date-utils: strip sign before rounding relative day count so future/past buckets are symmetric (36h -> 2 days) - validator: isEmail accepts long alphabetic TLDs and subdomains; isUrl accepts and range-validates ports; both remain bounded allowlists (no ReDoS) All 60 tests pass. No test files or dependencies changed.
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.
Summary
Fixes all 16 failing tests across the utility library. 60 pass / 0 fail (was 44/16). No test files modified, no dependencies added.
dividethrows on a zero divisor instead of returningInfinity.wordCountcollapses consecutive whitespace;truncateimplemented (word-boundary cut, ellipsis counts towardmaxLength, never exceeds it).remove,update(partial-safe), andsortBy(priority / status / createdAt).isEmailaccepts long alphabetic TLDs (.museum) and subdomains;isUrlaccepts and range-validates ports (1–65535). Both remain bounded allowlists — reviewed clear of ReDoS and over-permissiveness.Testing
bun test→ 60 pass, 0 failbunx tsc --noEmit→ cleanReview notes
A review pass caught a symmetry bug the tests didn't cover (future dates rounded down one bucket) and it was fixed. Validator changes were checked against seven backtracking-attack shapes with linear scaling.
Assumptions
src/implementation files were changed; test semantics were treated as the source of truth.docs/review-findings scratch file was intentionally left out of the commit.