mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-16 06:51:27 +00:00
Extract updateSellIn
This commit is contained in:
parent
ea88b3db9c
commit
03379118c6
@ -21,9 +21,7 @@ export class GildedRose {
|
||||
this.items.forEach((item, i) => {
|
||||
item.quality = updateItemQuality(item)
|
||||
|
||||
if (item.name != 'Sulfuras, Hand of Ragnaros') {
|
||||
item.sellIn = item.sellIn - 1;
|
||||
}
|
||||
updateSellIn(item)
|
||||
|
||||
item.quality = sellInBelow0(item)
|
||||
})
|
||||
@ -32,6 +30,11 @@ export class GildedRose {
|
||||
}
|
||||
}
|
||||
|
||||
function updateSellIn(item: Item) {
|
||||
if (item.name != 'Sulfuras, Hand of Ragnaros') {
|
||||
item.sellIn = item.sellIn - 1;
|
||||
}
|
||||
}
|
||||
|
||||
function updateItemQuality({name, quality, sellIn, ...rest}: Item): number {
|
||||
if (name === 'Sulfuras, Hand of Ragnaros') {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user