mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-15 14:31:28 +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-preset-env": "1.7.0",
|
||||
"babel-register": "^6.26.0",
|
||||
"jasmine": "^3.2.0"
|
||||
"glob": "^7.1.6",
|
||||
"jasmine": "^3.2.0",
|
||||
"path": "^0.12.7"
|
||||
},
|
||||
"babel": {
|
||||
"presets": [
|
||||
[
|
||||
"env", {
|
||||
"targets": { "node": "current" }
|
||||
"env",
|
||||
{
|
||||
"targets": {
|
||||
"node": "current"
|
||||
}
|
||||
}
|
||||
]
|
||||
],
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
exports.regex_matcher = /backstage pass/
|
||||
exports.regex_matcher = /backstage pass/;
|
||||
exports.qualityChange = function (sellIn, quality) {
|
||||
if (sellIn <= 0) {
|
||||
return -quality;
|
||||
@ -9,4 +9,4 @@ exports.qualityChange = function (sellIn, quality) {
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -1,9 +1,20 @@
|
||||
const standardItem = require('./standard_update.js')
|
||||
const backstagePass = require('./backstage_pass_update.js')
|
||||
const agedBrie = require('./aged_brie_update.js')
|
||||
const sulfuras = require('./sulfuras_update.js')
|
||||
var glob = require('glob')
|
||||
, path = require('path');
|
||||
|
||||
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 {
|
||||
constructor(items = []) {
|
||||
|
||||
@ -4,4 +4,4 @@ exports.qualityChange = function (sellIn) {
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
};
|
||||
Loading…
Reference in New Issue
Block a user