From f856c1efe555e6fd9fd7bb6851be277d7a9351da Mon Sep 17 00:00:00 2001 From: Lukas Siemon Date: Sun, 19 Jun 2022 20:37:48 -0700 Subject: [PATCH] fix: adjusted logic I'm not sure I understand what is happening here, but this change should not change functionality. However I'm suspecting that the line `gparent.splice(gproperty, gproperty);` is incorrect and instead `gparent.splice(gproperty, 1);` is what we want? --- tasks/reference.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/tasks/reference.js b/tasks/reference.js index ec0996e14..5c8c4fc2c 100644 --- a/tasks/reference.js +++ b/tasks/reference.js @@ -19,15 +19,14 @@ var revReplace = require('gulp-rev-replace'); const ignoreVersionImcompatibleProperties = async (data, version) => { const { default: objectScan } = await import('object-scan') objectScan(['**.x-from-version'], { - filterFn: ({ value, depth, key, gparent }) => { + filterFn: ({ value, gparent, gproperty }) => { if (`${version}` < value) { - const propertyName = key[depth - 2]; - try { + if (typeof gproperty === 'number') { // If element if array. - gparent.splice(propertyName, propertyName); - } catch (e) { + gparent.splice(gproperty, gproperty); + } else { // If element is object. - delete gparent[propertyName]; + delete gparent[gproperty]; } } },