From aa91ed2c92dd78433cc1327e7b7a1b06b10ebb86 Mon Sep 17 00:00:00 2001 From: Marcus Balbi Date: Mon, 24 Aug 2020 21:37:33 -0300 Subject: [PATCH] Budget class --- .../discounts-calculator/Budget.ts | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 src/chain-of-responsability/discounts-calculator/Budget.ts diff --git a/src/chain-of-responsability/discounts-calculator/Budget.ts b/src/chain-of-responsability/discounts-calculator/Budget.ts new file mode 100644 index 0000000..6ac23ca --- /dev/null +++ b/src/chain-of-responsability/discounts-calculator/Budget.ts @@ -0,0 +1,20 @@ +import Product from "./Product"; + +export default class Budget { + private items: Array; + + constructor() { + this.items = []; + } + + add(product: Product): Budget { + this.items.push(product); + return this; + } + + getItems(): Array { + const nItems: Array = [...this.items]; + + return nItems; + } +}