Skip to content

Simplify localStorage null check for better readability#816

Merged
arifszn merged 1 commit intoarifszn:mainfrom
Chy-Zaber-Bin-Zahid:refactor/improve-code-readability
Jan 6, 2026
Merged

Simplify localStorage null check for better readability#816
arifszn merged 1 commit intoarifszn:mainfrom
Chy-Zaber-Bin-Zahid:refactor/improve-code-readability

Conversation

@Chy-Zaber-Bin-Zahid
Copy link
Contributor

Before:

!(localStorage.getItem(LOCAL_STORAGE_KEY_NAME) === null)

After:

localStorage.getItem(LOCAL_STORAGE_KEY_NAME) !== null

Changes:

  • Replaced negated equality check with direct positive comparison
  • Improved code readability by eliminating double negation
  • Made the intent more explicit and easier to understand

This follows clean code best practices by preferring positive conditionals over negated ones

@arifszn arifszn merged commit 1c6fee2 into arifszn:main Jan 6, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants