From 3c5665969715b4ee0c35c84fc2d8efec1bb6bb59 Mon Sep 17 00:00:00 2001 From: alexandercerutti Date: Sun, 26 Aug 2018 12:40:03 +0200 Subject: [PATCH] Fixed condition for transitType --- index.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index 537d063..2cd96e5 100644 --- a/index.js +++ b/index.js @@ -533,13 +533,13 @@ class Pass { } }); - if (this.type === "boardingPass" && this.transitType) { - passFile[this.type]["transitType"] = this.transitType; - } else { + if (!this.transitType && this.type === "boardingPass") { throw new Error("Cannot proceed with pass creation. transitType field is required for boardingPasses."); } - return Promise.resolve(Buffer.from(JSON.stringify(passFile))); + passFile[this.type]["transitType"] = this.transitType; + + return Buffer.from(JSON.stringify(passFile)); } /**