mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-17 23:41:27 +00:00
Lift side effects
This commit is contained in:
parent
88982514b1
commit
8cbae0fd1b
@ -21,7 +21,7 @@ export class GildedRose {
|
|||||||
this.items.forEach((item, i) => {
|
this.items.forEach((item, i) => {
|
||||||
item.quality = updateItemQuality(item)
|
item.quality = updateItemQuality(item)
|
||||||
|
|
||||||
updateSellIn(item)
|
item.sellIn = updateSellIn(item)
|
||||||
|
|
||||||
item.quality = sellInBelow0(item)
|
item.quality = sellInBelow0(item)
|
||||||
})
|
})
|
||||||
@ -30,9 +30,9 @@ export class GildedRose {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateSellIn(item: Item) {
|
function updateSellIn({name, sellIn}: Item) {
|
||||||
if (item.name == 'Sulfuras, Hand of Ragnaros') return
|
if (name == 'Sulfuras, Hand of Ragnaros') return sellIn
|
||||||
item.sellIn = item.sellIn - 1;
|
return sellIn - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateItemQuality({name, quality, sellIn, ...rest}: Item): number {
|
function updateItemQuality({name, quality, sellIn, ...rest}: Item): number {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user