mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-03-01 05:11:11 +00:00
Move conditional into sellInBelow0
This commit is contained in:
parent
2bf8dbde29
commit
138ad0daab
@ -45,15 +45,14 @@ export class GildedRose {
|
||||
if (item.name != 'Sulfuras, Hand of Ragnaros') {
|
||||
item.sellIn = item.sellIn - 1;
|
||||
}
|
||||
if (item.sellIn < 0) {
|
||||
item.quality = this.sellInBelow0(item)
|
||||
}
|
||||
})
|
||||
|
||||
return this.items;
|
||||
}
|
||||
|
||||
private sellInBelow0(item: Item): number {
|
||||
if (item.sellIn < 0) {
|
||||
if (item.name == 'Sulfuras, Hand of Ragnaros') return item.quality;
|
||||
|
||||
if (item.name == 'Aged Brie') {
|
||||
@ -70,7 +69,7 @@ export class GildedRose {
|
||||
if (item.quality > 0) {
|
||||
return item.quality - 1
|
||||
}
|
||||
|
||||
}
|
||||
return item.quality
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user