mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-10 04:01:19 +00:00
Use strict equality operator over loose equality operator
Use strict equality operator over loose equality operator because it is seen as a best practice in the js/ts community.
This commit is contained in:
parent
ba40febb07
commit
6445f7f797
@ -28,46 +28,54 @@ export class GildedRose {
|
|||||||
|
|
||||||
updateQuality() {
|
updateQuality() {
|
||||||
for (let i = 0; i < this.items.length; i++) {
|
for (let i = 0; i < this.items.length; i++) {
|
||||||
if (this.items[i].name != 'Aged Brie' && this.items[i].name != 'Backstage passes to a TAFKAL80ETC concert') {
|
if (
|
||||||
|
this.items[i].name !== "Aged Brie" &&
|
||||||
|
this.items[i].name !== "Backstage passes to a TAFKAL80ETC concert"
|
||||||
|
) {
|
||||||
if (this.items[i].quality > 0) {
|
if (this.items[i].quality > 0) {
|
||||||
if (this.items[i].name != 'Sulfuras, Hand of Ragnaros') {
|
if (this.items[i].name !== "Sulfuras, Hand of Ragnaros") {
|
||||||
this.items[i].quality = this.items[i].quality - 1
|
this.items[i].quality = this.items[i].quality - 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (this.items[i].quality < 50) {
|
if (this.items[i].quality < 50) {
|
||||||
this.items[i].quality = this.items[i].quality + 1
|
this.items[i].quality = this.items[i].quality + 1;
|
||||||
if (this.items[i].name == 'Backstage passes to a TAFKAL80ETC concert') {
|
if (
|
||||||
|
this.items[i].name === "Backstage passes to a TAFKAL80ETC concert"
|
||||||
|
) {
|
||||||
if (this.items[i].sellIn < 11) {
|
if (this.items[i].sellIn < 11) {
|
||||||
if (this.items[i].quality < 50) {
|
if (this.items[i].quality < 50) {
|
||||||
this.items[i].quality = this.items[i].quality + 1
|
this.items[i].quality = this.items[i].quality + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (this.items[i].sellIn < 6) {
|
if (this.items[i].sellIn < 6) {
|
||||||
if (this.items[i].quality < 50) {
|
if (this.items[i].quality < 50) {
|
||||||
this.items[i].quality = this.items[i].quality + 1
|
this.items[i].quality = this.items[i].quality + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (this.items[i].name != 'Sulfuras, Hand of Ragnaros') {
|
if (this.items[i].name !== "Sulfuras, Hand of Ragnaros") {
|
||||||
this.items[i].sellIn = this.items[i].sellIn - 1;
|
this.items[i].sellIn = this.items[i].sellIn - 1;
|
||||||
}
|
}
|
||||||
if (this.items[i].sellIn < 0) {
|
if (this.items[i].sellIn < 0) {
|
||||||
if (this.items[i].name != 'Aged Brie') {
|
if (this.items[i].name !== "Aged Brie") {
|
||||||
if (this.items[i].name != 'Backstage passes to a TAFKAL80ETC concert') {
|
if (
|
||||||
|
this.items[i].name !== "Backstage passes to a TAFKAL80ETC concert"
|
||||||
|
) {
|
||||||
if (this.items[i].quality > 0) {
|
if (this.items[i].quality > 0) {
|
||||||
if (this.items[i].name != 'Sulfuras, Hand of Ragnaros') {
|
if (this.items[i].name !== "Sulfuras, Hand of Ragnaros") {
|
||||||
this.items[i].quality = this.items[i].quality - 1
|
this.items[i].quality = this.items[i].quality - 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.items[i].quality = this.items[i].quality - this.items[i].quality
|
this.items[i].quality =
|
||||||
|
this.items[i].quality - this.items[i].quality;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (this.items[i].quality < 50) {
|
if (this.items[i].quality < 50) {
|
||||||
this.items[i].quality = this.items[i].quality + 1
|
this.items[i].quality = this.items[i].quality + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user