Skip to content

Small code simplifications and add tests#22

Merged
cmdcolin merged 1 commit intomainfrom
opt
Jan 18, 2026
Merged

Small code simplifications and add tests#22
cmdcolin merged 1 commit intomainfrom
opt

Conversation

@cmdcolin
Copy link
Contributor

Bug fixes

  • Added input validation for empty/whitespace search strings to prevent undefined.toLowerCase() error
  • Added filter for empty parts when parsing line data

Refactoring

  • Restructured search() to use nested if statements instead of early returns
  • Simplified termination logic in search loop - combined conditions to avoid duplicate startsWith calls
  • Renamed _getBuffer to getBuffer (underscore unnecessary with private modifier)
  • Removed dead code (len < 0 check that could never be true)
  • Fixed variable shadowing in sum() function (sum → total)
  • Simplified filter syntax (!!f → f)

Tests

  • Added edge case tests for empty string, whitespace, and leading/trailing space handling
  • Added unit tests for dedupe(), sum(), and concatUint8Array() utilities

@cmdcolin cmdcolin merged commit 3ec3085 into main Jan 18, 2026
1 check passed
@cmdcolin cmdcolin deleted the opt branch January 18, 2026 17:23
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