Move sellInBelow0 out of class

This commit is contained in:
Jesper 2022-04-13 16:37:02 +02:00
parent e667c5d091
commit 481a303bae

View File

@ -45,13 +45,14 @@ export class GildedRose {
if (item.name != 'Sulfuras, Hand of Ragnaros') { if (item.name != 'Sulfuras, Hand of Ragnaros') {
item.sellIn = item.sellIn - 1; item.sellIn = item.sellIn - 1;
} }
item.quality = this.sellInBelow0(item) item.quality = sellInBelow0(item)
}) })
return this.items; return this.items;
} }
}
private sellInBelow0({quality, name, sellIn}: Item): number { function sellInBelow0({quality, name, sellIn}: Item): number {
if (sellIn >= 0) return quality if (sellIn >= 0) return quality
if (name == 'Sulfuras, Hand of Ragnaros') return quality; if (name == 'Sulfuras, Hand of Ragnaros') return quality;
@ -72,5 +73,4 @@ export class GildedRose {
} }
return quality return quality
}
} }