Skip to content

Commit

Permalink
chore: simplify conditional using ?
Browse files Browse the repository at this point in the history
  • Loading branch information
yanfali committed Nov 6, 2024
1 parent 4320f88 commit 51546e1
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions src/store/keycodes.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@ const keycodePickerTabLayout = {

function getOSKeyboardLayout() {
let osKeyboardLayout = store.getters['app/osKeyboardLayout'];
if (
isUndefined(osKeyboardLayout) ||
!keymapExtras[osKeyboardLayout]
) {
if (isUndefined(osKeyboardLayout) || !keymapExtras[osKeyboardLayout]) {
const fallbackOSKeyboardLayout = 'keymap_us';
console.log(
`The stored OS keyboard layout value (${osKeyboardLayout}) is not a valid value! Falling back to '${fallbackOSKeyboardLayout}'.`
Expand All @@ -38,10 +35,7 @@ function isANSI() {

function toLocaleKeycode(keycodeLUT, keycodeObject) {
console.assert(!isUndefined(keycodeLUT));
if (
!keycodeObject.name ||
!keycodeObject.code
) {
if (!keycodeObject.name || !keycodeObject.code) {
// Not an object describing a keyboard key; return as is
return keycodeObject;
}
Expand Down Expand Up @@ -75,8 +69,8 @@ function countMatches(filter, collection) {
if (!isUndefined(code)) {
if (
code.includes(filter) ||
(name && name.toUpperCase().includes(filter)) ||
(title && title.toUpperCase().includes(filter))
name?.toUpperCase().includes(filter) ||
title?.toUpperCase().includes(filter)
) {
matchCount += 1;
}
Expand Down

0 comments on commit 51546e1

Please sign in to comment.