mirror of
https://github.com/marcogll/passkit-generator.git
synced 2026-03-15 18:25:24 +00:00
Replaced findIndex for find to get directly the pass type
This commit is contained in:
@@ -528,16 +528,13 @@ class Pass {
|
|||||||
let passTypes = ["boardingPass", "eventTicket", "coupon", "generic", "storeCard"];
|
let passTypes = ["boardingPass", "eventTicket", "coupon", "generic", "storeCard"];
|
||||||
|
|
||||||
let passFile = JSON.parse(passBuffer.toString("utf8"));
|
let passFile = JSON.parse(passBuffer.toString("utf8"));
|
||||||
let index = passTypes.findIndex(passType => passFile.hasOwnProperty(passType));
|
this.type = passTypes.find(type => passFile.hasOwnProperty(type));
|
||||||
|
|
||||||
if (index == -1) {
|
if (!this.type) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
let type = passTypes[index];
|
return schema.isValid(passFile[this.type], "passDict");
|
||||||
|
|
||||||
this.type = type;
|
|
||||||
return schema.isValid(passFile[type], "passDict");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user