mirror of
https://github.com/marcogll/passkit-generator.git
synced 2026-03-15 21:25:26 +00:00
Removed early return in _patch since not needed (this.props is not the only property to be checked in _patch)
This commit is contained in:
37
index.js
37
index.js
@@ -499,29 +499,28 @@ class Pass {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
_patch(passBuffer) {
|
_patch(passBuffer) {
|
||||||
if (!Object.keys(this.props).length) {
|
|
||||||
return Promise.resolve(passBuffer);
|
|
||||||
}
|
|
||||||
|
|
||||||
const rgbValues = ["backgroundColor", "foregroundColor", "labelColor"];
|
|
||||||
let passFile = JSON.parse(passBuffer.toString("utf8"));
|
let passFile = JSON.parse(passBuffer.toString("utf8"));
|
||||||
|
|
||||||
rgbValues.filter(v => this.props[v] && !isValidRGB(this.props[v])).forEach(v => delete this.props[v]);
|
if (Object.keys(this.props).length) {
|
||||||
|
const rgbValues = ["backgroundColor", "foregroundColor", "labelColor"];
|
||||||
|
|
||||||
if (this.shouldOverwrite) {
|
rgbValues.filter(v => this.props[v] && !isValidRGB(this.props[v])).forEach(v => delete this.props[v]);
|
||||||
Object.assign(passFile, this.props);
|
|
||||||
} else {
|
if (this.shouldOverwrite) {
|
||||||
Object.keys(this.props).forEach(prop => {
|
Object.assign(passFile, this.props);
|
||||||
if (passFile[prop]) {
|
} else {
|
||||||
if (passFile[prop] instanceof Array) {
|
Object.keys(this.props).forEach(prop => {
|
||||||
passFile[prop].push(...this.props[prop]);
|
if (passFile[prop]) {
|
||||||
} else if (passFile[prop] instanceof Object) {
|
if (passFile[prop] instanceof Array) {
|
||||||
Object.assign(passFile[prop], this.props[prop]);
|
passFile[prop].push(...this.props[prop]);
|
||||||
|
} else if (passFile[prop] instanceof Object) {
|
||||||
|
Object.assign(passFile[prop], this.props[prop]);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
passFile[prop] = this.props[prop];
|
||||||
}
|
}
|
||||||
} else {
|
});
|
||||||
passFile[prop] = this.props[prop];
|
}
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fieldsName.forEach(area => {
|
fieldsName.forEach(area => {
|
||||||
|
|||||||
Reference in New Issue
Block a user