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, Jun 23, 6:14 AM
Unknown Object (File)
Wed, May 29, 3:57 PM
Unknown Object (File)
Wed, May 29, 3:56 PM
Unknown Object (File)
Wed, May 29, 3:56 PM
Unknown Object (File)
Wed, May 29, 3:56 PM
Unknown Object (File)
May 17 2024, 4:30 AM
Unknown Object (File)
May 14 2024, 4:19 PM
Unknown Object (File)
Apr 21 2024, 3:58 PM
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