mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-17 15:31:27 +00:00
Use guard in sellInBelow0
This commit is contained in:
parent
138ad0daab
commit
e21ec0cc5b
@ -52,24 +52,25 @@ export class GildedRose {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private sellInBelow0(item: Item): number {
|
private sellInBelow0(item: Item): number {
|
||||||
if (item.sellIn < 0) {
|
if (item.sellIn >= 0) return item.quality
|
||||||
if (item.name == 'Sulfuras, Hand of Ragnaros') return item.quality;
|
|
||||||
|
|
||||||
if (item.name == 'Aged Brie') {
|
if (item.name == 'Sulfuras, Hand of Ragnaros') return item.quality;
|
||||||
if (item.quality < 50) {
|
|
||||||
return item.quality + 1
|
if (item.name == 'Aged Brie') {
|
||||||
}
|
if (item.quality < 50) {
|
||||||
return item.quality
|
return item.quality + 1
|
||||||
}
|
|
||||||
|
|
||||||
if (item.name == 'Backstage passes to a TAFKAL80ETC concert') {
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
if (item.quality > 0) {
|
|
||||||
return item.quality - 1
|
|
||||||
}
|
}
|
||||||
|
return item.quality
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (item.name == 'Backstage passes to a TAFKAL80ETC concert') {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
if (item.quality > 0) {
|
||||||
|
return item.quality - 1
|
||||||
|
}
|
||||||
|
|
||||||
return item.quality
|
return item.quality
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user