Renamed _validateType to _hasValidType

This commit is contained in:
Alexander Cerutti
2019-04-27 20:40:28 +02:00
parent 1dcc624245
commit 3de6547591

View File

@@ -513,12 +513,12 @@ class Pass {
/** /**
* Checks if pass model type is one of the supported ones * Checks if pass model type is one of the supported ones
* *
* @method _validateType * @method _hasValidType
* @params {Buffer} passBuffer - buffer of the pass structure content * @params {string} passFile - parsed pass structure content
* @returns {Boolean} true if type is supported, false otherwise. * @returns {Boolean} true if type is supported, false otherwise.
*/ */
_validateType(passFile) { _hasValidType(passFile) {
let passTypes = ["boardingPass", "eventTicket", "coupon", "generic", "storeCard"]; let passTypes = ["boardingPass", "eventTicket", "coupon", "generic", "storeCard"];
this.type = passTypes.find(type => passFile.hasOwnProperty(type)); this.type = passTypes.find(type => passFile.hasOwnProperty(type));
@@ -542,7 +542,7 @@ class Pass {
const passStructBuffer = await readFile(path.resolve(this.model, "pass.json")) const passStructBuffer = await readFile(path.resolve(this.model, "pass.json"))
const parsedPassDefinition = JSON.parse(passStructBuffer.toString("utf8")); const parsedPassDefinition = JSON.parse(passStructBuffer.toString("utf8"));
if (!this._validateType(parsedPassDefinition)) { if (!this._hasValidType(parsedPassDefinition)) {
const eMessage = formatMessage("PASSFILE_VALIDATION_FAILED"); const eMessage = formatMessage("PASSFILE_VALIDATION_FAILED");
throw new Error(eMessage); throw new Error(eMessage);
} }