From 75b22daf73bbc85d8d285e1e595f05c40ec17ba0 Mon Sep 17 00:00:00 2001 From: Alexander Cerutti Date: Thu, 27 Jun 2019 23:49:52 +0200 Subject: [PATCH] Removed selected patching based on type for a direct replacement of the properties --- src/pass.ts | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/pass.ts b/src/pass.ts index c691923..2dd49d2 100644 --- a/src/pass.ts +++ b/src/pass.ts @@ -632,7 +632,7 @@ export class Pass implements PassIndexSignature { */ private _patch(passCoreBuffer: Buffer): Buffer { - const passFile = JSON.parse(passCoreBuffer.toString()); + let passFile = JSON.parse(passCoreBuffer.toString()); if (Object.keys(this._props).length) { /* @@ -645,15 +645,7 @@ export class Pass implements PassIndexSignature { .filter(v => this._props[v] && !isValidRGB(this._props[v])) .forEach(v => delete this._props[v]); - Object.keys(this._props).forEach(prop => { - if (passFile[prop] && passFile[prop] instanceof Array) { - passFile[prop] = [ ...passFile[prop], ...this._props[prop] ]; - } else if (passFile[prop] && passFile[prop] instanceof Object) { - passFile[prop] = { ...passFile[prop], ...this._props[prop] }; - } else { - passFile[prop] = this._props[prop]; - } - }); + passFile = { ...passFile, ...this._props }; } this._fields.forEach(field => {