Skip to content

Instantly share code, notes, and snippets.

@n8rzz
Created November 18, 2021 20:36
Show Gist options
  • Save n8rzz/acba7593f83e67c046339349af7ea1a6 to your computer and use it in GitHub Desktop.
Save n8rzz/acba7593f83e67c046339349af7ea1a6 to your computer and use it in GitHub Desktop.
exclusive-if.ts
// bad
function displayName(name) {
if (name) {
return name;
}
return '';
}
// good
function displayName(name) {
if (!name) {
return '';
}
return name;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment