From 656c74b3d9c4fd8d20bf32711cd83a51210cd341 Mon Sep 17 00:00:00 2001 From: alexandercerutti Date: Tue, 21 Aug 2018 18:08:29 +0200 Subject: [PATCH] Added value check for three keys through isValidRGB func --- index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/index.js b/index.js index 3f9c74b..dd183e5 100644 --- a/index.js +++ b/index.js @@ -341,6 +341,7 @@ class Pass { return Promise.resolve(passBuffer); } + const rgbValues = ["backgroundColor", "foregroundColor", "labelColor"]; let passFile = JSON.parse(passBuffer.toString("utf8")); // "barcodes" support got introduced in iOS 9 as array of barcode. @@ -383,6 +384,8 @@ class Pass { delete this.props["barcode"]; + rgbValues.filter(v => this.props[v] && !isValidRGB(this.props[v])).forEach(v => delete this.props[v]); + if (this.shouldOverwrite) { Object.assign(passFile, this.props); } else {