mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-16 06:51:27 +00:00
Add item types to folder and require dynamically
This commit is contained in:
parent
09d7cd7783
commit
08de5f7272
2292
js-jasmine/package-lock.json
generated
Normal file
2292
js-jasmine/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -24,13 +24,18 @@
|
|||||||
"babel-core": "^6.26.0",
|
"babel-core": "^6.26.0",
|
||||||
"babel-preset-env": "1.7.0",
|
"babel-preset-env": "1.7.0",
|
||||||
"babel-register": "^6.26.0",
|
"babel-register": "^6.26.0",
|
||||||
"jasmine": "^3.2.0"
|
"glob": "^7.1.6",
|
||||||
|
"jasmine": "^3.2.0",
|
||||||
|
"path": "^0.12.7"
|
||||||
},
|
},
|
||||||
"babel": {
|
"babel": {
|
||||||
"presets": [
|
"presets": [
|
||||||
[
|
[
|
||||||
"env", {
|
"env",
|
||||||
"targets": { "node": "current" }
|
{
|
||||||
|
"targets": {
|
||||||
|
"node": "current"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
exports.regex_matcher = /backstage pass/
|
exports.regex_matcher = /backstage pass/;
|
||||||
exports.qualityChange = function (sellIn, quality) {
|
exports.qualityChange = function (sellIn, quality) {
|
||||||
if (sellIn <= 0) {
|
if (sellIn <= 0) {
|
||||||
return -quality;
|
return -quality;
|
||||||
@ -9,4 +9,4 @@ exports.qualityChange = function (sellIn, quality) {
|
|||||||
} else {
|
} else {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
@ -1,9 +1,20 @@
|
|||||||
const standardItem = require('./standard_update.js')
|
var glob = require('glob')
|
||||||
const backstagePass = require('./backstage_pass_update.js')
|
, path = require('path');
|
||||||
const agedBrie = require('./aged_brie_update.js')
|
|
||||||
const sulfuras = require('./sulfuras_update.js')
|
|
||||||
|
|
||||||
const itemTypes = [backstagePass, agedBrie, sulfuras]
|
let itemTypes = [];
|
||||||
|
|
||||||
|
glob.sync('./src/item_types/**/*.js').forEach(function (file) {
|
||||||
|
itemTypes.push(require(path.resolve(file)));
|
||||||
|
});
|
||||||
|
|
||||||
|
const standardItem = require('./standard_update.js')
|
||||||
|
|
||||||
|
// const standardItem = require('./item_types/standard_update.js')
|
||||||
|
// const backstagePass = require('./item_types/backstage_pass_update.js')
|
||||||
|
// const agedBrie = require('./item_types/aged_brie_update.js')
|
||||||
|
// const sulfuras = require('./item_types/sulfuras_update.js')
|
||||||
|
|
||||||
|
// const itemTypes = [backstagePass, agedBrie, sulfuras]
|
||||||
|
|
||||||
class Shop {
|
class Shop {
|
||||||
constructor(items = []) {
|
constructor(items = []) {
|
||||||
|
|||||||
@ -4,4 +4,4 @@ exports.qualityChange = function (sellIn) {
|
|||||||
} else {
|
} else {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
Loading…
Reference in New Issue
Block a user