From bb67302d3ae64c84ecf9c6594fdce8cf6d4c4043 Mon Sep 17 00:00:00 2001 From: Dan Holmes Date: Thu, 3 Dec 2020 14:30:34 +0000 Subject: [PATCH] Extract _updateSellIn --- js-jasmine/src/shop.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/js-jasmine/src/shop.js b/js-jasmine/src/shop.js index 6f3762b7..6a9317d1 100644 --- a/js-jasmine/src/shop.js +++ b/js-jasmine/src/shop.js @@ -33,9 +33,7 @@ class Shop { } } } - if (item.name != 'Sulfuras, Hand of Ragnaros') { - item.sellIn = item.sellIn - 1; - } + this._updateSellIn(item) if (item.sellIn < 0) { if (item.name != 'Aged Brie') { if (item.name != 'Backstage passes to a TAFKAL80ETC concert') { @@ -54,6 +52,12 @@ class Shop { } } } + + _updateSellIn(item) { + if (item.name != 'Sulfuras, Hand of Ragnaros') { + item.sellIn = item.sellIn - 1; + } + } } module.exports = { Shop