Skip to content

All initialization should be value to pass in the conditional test #10

@FilipeBeck

Description

@FilipeBeck

It would be more useful if all initialized values ​​were automatically tested against null and undefined, failing the test if any value does not pass the test. Any other value (including 0, "" or false) will pass the test.

if (let oneDate = getOneDate(), anotherDate = getAnotherDate(); oneDate.getDay() >= 5) {
  // ...
}

Here, if oneDate or anotherDate is null | undefined, the test fails. Otherwise, if both have values, check if oneDate.getDay () >= 5

Perhaps where could be used instead of ;.

if (let oneDate = getOneDate() where oneDate.getDay() >= 5) {
  // ...
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions