Files
bun.sh/packages/bun-debug-adapter-protocol/src/debugger/fixtures/with-sourcemap.ts
Ashcon Partovi 2a9e967fd1 More improvements to debugger support (#4345)
* More fixes for dap

* More changes

* More changes 2

* More fixes

* Fix debugger.ts

* Bun Terminal
2023-08-26 02:34:25 -07:00

47 lines
703 B
TypeScript

export default {
fetch(request: Request): Response {
const animal = getAnimal(request.url);
const voice = animal.talk();
return new Response(voice);
},
};
function getAnimal(query: string): Animal {
switch (query.split("/").pop()) {
case "dog":
return new Dog();
case "cat":
return new Cat();
}
return new Bird();
}
interface Animal {
readonly name: string;
talk(): string;
}
class Dog implements Animal {
name = "dog";
talk(): string {
return "woof";
}
}
class Cat implements Animal {
name = "cat";
talk(): string {
return "meow";
}
}
class Bird implements Animal {
name = "bird";
talk(): string {
return "chirp";
}
}