Added value check for three keys through isValidRGB func

This commit is contained in:
alexandercerutti
2018-08-21 18:08:29 +02:00
parent 583e09fe3a
commit 656c74b3d9

View File

@@ -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 {