From 88982514b151ce1d0b55b2bb687a8d2f571b9a5b Mon Sep 17 00:00:00 2001 From: Jesper Date: Wed, 13 Apr 2022 17:17:54 +0200 Subject: [PATCH] Use guard --- TypeScript/app/gilded-rose.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/TypeScript/app/gilded-rose.ts b/TypeScript/app/gilded-rose.ts index e376b51d..b0f4225a 100644 --- a/TypeScript/app/gilded-rose.ts +++ b/TypeScript/app/gilded-rose.ts @@ -31,9 +31,8 @@ export class GildedRose { } function updateSellIn(item: Item) { - if (item.name != 'Sulfuras, Hand of Ragnaros') { - item.sellIn = item.sellIn - 1; - } + if (item.name == 'Sulfuras, Hand of Ragnaros') return + item.sellIn = item.sellIn - 1; } function updateItemQuality({name, quality, sellIn, ...rest}: Item): number {