semaphore icon indicating copy to clipboard operation
semaphore copied to clipboard

Refactor Transport Selection Logic in SemaphoreViem Constructor

Open ultraviolet10 opened this issue 5 months ago • 0 comments

Describe the improvement you're thinking about

The current constructor logic for selecting the transport in SemaphoreViem is a bit redundant, with multiple checks and assignments for options.transport. This can be simplified using a single ternary expression, making the code more concise and easier to follow. This avoids mutating the options object and makes the intent clearer.

Describe alternatives you've considered

Keeping the current multi-step logic with separate if/else blocks. Downside: This is harder to read, more error-prone, and mutates the options object unnecessarily.

Additional context

The refactor is a small but meaningful code quality improvement, reducing cognitive load for future contributors. The new approach is more idiomatic and easier to maintain. This change is backwards compatible and does not affect the public API.

ultraviolet10 avatar Jul 14 '25 11:07 ultraviolet10