Moved settings checks in generate() and moved generate() content in an inline arrow function

This commit is contained in:
alexandercerutti
2018-07-24 16:31:26 +02:00
parent 514a15abd5
commit 599280cf5c

View File

@@ -8,13 +8,11 @@ const schema = require("./schema.js");
class Pass {
constructor(options) {
this.options = options;
this.passTypes = ["boardingPass", "eventTicket", "coupon", "generic", "storeCard"];
this.overrides = options.overrides || {};
this.Certificates = {};
this.model = "";
this._parseSettings(options)
.catch(e => console.log(e));
}
/**
@@ -29,6 +27,7 @@ class Pass {
let archive = archiver("zip");
return new Promise((success, reject) => {
let _gen = (() => {
fs.readdir(this.model, (err, files) => {
if (err) {
return reject({
@@ -189,7 +188,12 @@ class Pass {
async.concat(pathList, fs.readFile, _addBuffers);
});
})
});
this._parseSettings(this.options)
.then(_gen)
.catch(reject)
});
}