Changed back _patch method to return a Promise

This commit is contained in:
alexandercerutti
2018-08-07 16:22:09 +02:00
parent bab73d7b62
commit 551dd8a8e0

View File

@@ -297,9 +297,9 @@ class Pass {
*/
_patch(options, passBuffer) {
return new Promise((resolve, reject) => {
if (!options) {
return passBuffer;
return resolve(passBuffer);
}
let passFile = JSON.parse(passBuffer.toString("utf8"));
@@ -311,7 +311,7 @@ class Pass {
let barcode = passFile["barcode"];
if (!(barcode instanceof Object) || !schema.isValid(barcode, schema.constants.barcode) || !options.barcode && barcode.message === "") {
console.log("\x1b[41m", `Barcode syntax of the chosen model (${path.parse(this.model).base}) is not correct or the override content was not provided got removed. Please refer to https://apple.co/2myAbst.`, "\x1b[0m");
console.log("\x1b[41m", `Barcode syntax of the chosen model (${path.parse(this.model).base}) is not correct and got removed or the override content was not provided. Please refer to https://apple.co/2myAbst.`, "\x1b[0m");
delete passFile["barcode"];
} else {
// options.barcode may not be defined
@@ -344,7 +344,8 @@ class Pass {
Object.assign(passFile, options);
return Buffer.from(JSON.stringify(passFile));
return resolve(Buffer.from(JSON.stringify(passFile)));
});
}
/**