Skip to content

fix: implement missing functionality and fix edge cases across utility library#191

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier1-2361-1780337561
Open

fix: implement missing functionality and fix edge cases across utility library#191
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier1-2361-1780337561

Conversation

@stooit
Copy link
Copy Markdown
Contributor

@stooit stooit commented Jun 1, 2026

Summary

  • calculator.ts: Throw Error on division by zero instead of returning Infinity
  • string-utils.ts: Fix wordCount to handle multiple consecutive spaces; implement truncate with word-boundary logic
  • task-manager.ts: Implement remove, update, and sortBy methods
  • date-utils.ts: Use Math.round for day calculation in formatRelative (fixes off-by-one for 36h → "2 days ago")
  • validator.ts: Allow TLDs longer than 4 characters in email validation; allow URLs with port numbers

Testing

All 60 tests pass (bun test). No test files were modified.

Assumptions

  • Division by zero throws a generic Error (not a custom type) since tests use toThrow() without specifying a message
  • truncate respects word boundaries when possible but falls back to hard truncation if no word boundary fits within the limit
  • sortBy("priority") uses high > medium > low ordering
  • sortBy("createdAt") sorts oldest-first (ascending)

…y library

- calculator: throw Error on division by zero instead of returning Infinity
- string-utils: fix wordCount to handle multiple spaces; implement truncate
- task-manager: implement remove, update, and sortBy methods
- date-utils: use Math.round for day calculation in formatRelative
- validator: allow TLDs longer than 4 chars; allow URLs with ports
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