mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-15 22:41:30 +00:00
19 lines
322 B
JavaScript
19 lines
322 B
JavaScript
function updateQuality(item) {
|
|
if (is(item)) {
|
|
item.quality += getQualityChange(item);
|
|
}
|
|
}
|
|
|
|
function getQualityChange(item) {
|
|
if (item.sellIn <= 0) {
|
|
return 2;
|
|
} else {
|
|
return 1;
|
|
}
|
|
}
|
|
|
|
function is(item) {
|
|
return item.name.toLowerCase().match(/aged brie/);
|
|
};
|
|
|
|
module.exports = { updateQuality, is }; |