← Back to design patterns map
🔌
Design Pattern

Adapter

Translate one interface into another interface your app expects.

structural

Visual Diagram

Your code expects send(msg)
-> Adapter
-> SDK uses deliver({ body })

When To Use

  • ->Wrapping third-party APIs
  • ->Migrating from one library to another
  • ->Protecting your domain from vendor-specific shapes
Used in: AWS SDK wrappers, Twilio adapters, payment adapters
adapter.js

Live Editor

Loading...

Output

Run code to see output...