Skip to content

Instantly share code, notes, and snippets.

@mickaelw
Last active March 1, 2020 10:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mickaelw/8c3114a8592ed35aeca9bbd7c23a7e30 to your computer and use it in GitHub Desktop.
Save mickaelw/8c3114a8592ed35aeca9bbd7c23a7e30 to your computer and use it in GitHub Desktop.
export class Basket {
//...
private applyDiscount(totalOfSameBookBorrowed: number, price: number): number {
switch (totalOfSameBookBorrowed) {
case 1:
return price
case 2:
return price * (1 - 0.05)
default:
return price * (1 - 0.25)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment