refactor: use nullish coalescing & optional chaining #195

Manually merged
norm merged 1 commit from refactor/use-null-coalesce-etc into main 2022-10-10 22:44:51 +00:00
Owner

Changes several places to use the afforementioned constructs in favour of ternary expressions.

Changes several places to use the afforementioned constructs in favour of ternary expressions.
norm reviewed 2022-10-10 22:36:06 +00:00
@ -13,3 +13,3 @@
export function getScrollPosition(el: Element | null): number {
const container = getScrollContainer(el);
return container == null ? window.scrollY : container.scrollTop;
return container.?scrollTop ?? window.scrollY;
Owner

I think this is a typo. Should be:

return container?.scrollTop ?? window.scrollY;
I think this is a typo. Should be: ```js return container?.scrollTop ?? window.scrollY; ```
Johann150 marked this conversation as resolved
Johann150 force-pushed refactor/use-null-coalesce-etc from eba9d9cc0f to 808c43377e 2022-10-10 22:39:37 +00:00 Compare
norm manually merged commit 13a3581817 into main 2022-10-10 22:44:51 +00:00
norm deleted branch refactor/use-null-coalesce-etc 2022-10-10 22:45:39 +00:00
Sign in to join this conversation.
No reviewers
No labels
feature
fix
upkeep
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: FoundKeyGang/FoundKey#195
No description provided.