Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: early return in fallback behavior
Fallback behavior should use early returns rather than else...if. Using early returns instead makes it possible to include looping logic without as many changes to the code. For example, we can now add such a thing: for ( const provider of providers ) { const maybe_command = provider[cmd]; if ( ! maybe_command ) continue; return maybe_command(); } Since the fact of whether or not this loop will find the command is determined by the outcome, rather than a conditional expression, it would be non-trivial to include it in the else...if chain.
- Loading branch information