Page MenuHomePhabricator

[web] Use nullish coalescing operator in `InputStateContainer`
ClosedPublic

Authored by abosh on Aug 18 2022, 9:58 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Nov 10, 2:42 PM
Unknown Object (File)
Sun, Nov 10, 2:42 PM
Unknown Object (File)
Sun, Nov 10, 2:42 PM
Unknown Object (File)
Fri, Nov 8, 12:51 PM
Unknown Object (File)
Sun, Nov 3, 2:35 PM
Unknown Object (File)
Oct 10 2024, 4:44 AM
Unknown Object (File)
Oct 10 2024, 4:44 AM
Unknown Object (File)
Oct 10 2024, 4:44 AM
Subscribers

Details

Summary

Quick change I noticed while reading this for video work (I opened the wrong InputStateContainer). Simply removes the ternary and replaces it with a nullish coalescing operator.

Test Plan

Since dimensions is an object, the only cases it will fail the ternary check is if it's null or undefined (since the object has to be falsy to fail the ternary check).

According to the MDN docs:

The nullish coalescing operator (??) is a logical operator that returns its right-hand side operand when its left-hand side operand is null or undefined.

So this covers the same cases as the ternary, and is more concise.

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable