-
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
lint(validators): refactor
len
conditions
In our validation procs, there are conditions like ```Nim if data.hasKey(key): if data[key].kind == JString: ``` where the condition being `true` represents the "happy path". To improve readability, let's try to do this consistently for every condition apart from the innermost one; it's easier to see the "happy path" when it minimises the number of `else`. This commit refactors the `len` conditions accordingly, so that we prefer `len > 0` and use `len == 0` only when there is no `else`. This commit also changes a `var` to a `let` to better convey that we don't mutate.
- Loading branch information
Showing
1 changed file
with
16 additions
and
16 deletions.
There are no files selected for viewing
This file contains 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