mirror of
https://github.com/marcogll/passkit-generator.git
synced 2026-03-15 16:25:21 +00:00
Moved settings checks in generate() and moved generate() content in an inline arrow function
This commit is contained in:
10
index.js
10
index.js
@@ -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)
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user