Switch case where I want to do some things if case A OR B and other things if case A XOR B?

Switch case where I want to do some things if case A OR B and other things if case A XOR B?

Look at this switch case statement. Cases 'response' and 'error' have a lot in common, but also one line that tells them apart.

Look at this switch case statement. Cases 'response' and 'error' have a lot in common, but also one line that tells them apart.

            switch (data.type) {
                case 'response':
                    const transactionId = data.trans_id;
                    const callbacks = commandCallbacks[transactionId];

                if (!callbacks) {
                    if (logger) logger(`Dropping received message that was not requested, transactionId: ${transactionId}`);
                    break;
                }

                clearTimeout(callbacks.timedOutTimer);
                callbacks.resolver(data);
                break;
            case 'error':                
                const transactionId = data.trans_id;
                const callbacks = commandCallbacks[transactionId];

                if (!callbacks) {
                    if (logger) logger(`Dropping received message that was not requested, transactionId: ${transactionId}`);
                    break;
                }

                clearTimeout(callbacks.timedOutTimer);
                callbacks.rejecter(data);
                break;
            case 'information':
            case 'progress':
            default:
                break;
        }

How can I simplify this code?

javascript

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

The essential JavaScript concepts that you should understand

The essential JavaScript concepts that you should understand - For successful developing and to pass a work interview

JavaScript Memory Management System

The main goal of this article is help to readers to understand that how memory management system performs in JavaScript. I will use a shorthand such as GC which means Garbage Collection. When the browsers use Javascript, they need any memory location to store objects, functions, and all other things. Let’s deep in dive that how things going to work in GC.

Grokking Call(), Apply() and Bind() Methods in JavaScript

In this article, we will have a look at the call(), apply() and bind() methods of JavaScript. Basically these 3 methods are used to control the invocation of the function.

JavaScript Tutorial: if-else Statement in JavaScript

This JavaScript tutorial is a step by step guide on JavaScript If Else Statements. Learn how to use If Else in javascript and also JavaScript If Else Statements. if-else Statement in JavaScript. JavaScript's conditional statements: if; if-else; nested-if; if-else-if. These statements allow you to control the flow of your program's execution based upon conditions known only during run time.

Top 15 Free JavaScript Frameworks for Web Applications

List of some useful JavaScript Frameworks and libraries for website, web apps, and mobile apps development, that developers should know about to make selection easier.