Commit ab9010e
authored
refactor: simplify null checks with optional chaining (#371)
This PR refactors conditional checks to use optional chaining, improving code readability and reducing boilerplate null checks.
- Logical operator can be refactored to optional chain: The original code used logical AND operators to guard property access (e.g., `if (levelEntry && levelEntry.rarity)` and `if (targetLink && targetLink.textContent.includes("Profile"))`), which can be verbose and error-prone. We replaced these with optional chaining (`if (levelEntry?.rarity)` and `if (targetLink?.textContent?.includes("Profile"))`) at the affected lines, ensuring safer and more concise null‐checks without altering runtime behavior.
> This Autofix was generated by AI. Please review the change before merging.
Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>1 parent 9bde5af commit ab9010eCopy full SHA for ab9010e
File tree
Expand file treeCollapse file tree
1 file changed
+2
-2
lines changedOpen diff view settings
Filter options
- src/assets/js
Expand file treeCollapse file tree
1 file changed
+2
-2
lines changedOpen diff view settings
Collapse file
+2-2Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
1062 | 1062 | |
1063 | 1063 | |
1064 | 1064 | |
1065 | | - |
| 1065 | + |
1066 | 1066 | |
1067 | 1067 | |
1068 | 1068 | |
| ||
1198 | 1198 | |
1199 | 1199 | |
1200 | 1200 | |
1201 | | - |
| 1201 | + |
1202 | 1202 | |
1203 | 1203 | |
1204 | 1204 | |
|
0 commit comments