mirror of
https://github.com/marcogll/passkit-generator.git
synced 2026-03-15 21:25:26 +00:00
Added value check for three keys through isValidRGB func
This commit is contained in:
3
index.js
3
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 {
|
||||
|
||||
Reference in New Issue
Block a user