From f69722ebe8b3b68a2b5ed3a0e6be0ba1a22bc32f Mon Sep 17 00:00:00 2001 From: Arpit Narechania Date: Sat, 9 Sep 2023 23:18:23 -0400 Subject: [PATCH] push only valid values to resiliencyData --- src/index.ts | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/index.ts b/src/index.ts index 245558c..8fd1485 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1002,14 +1002,16 @@ export class BinGuru { let resiliencyData: object[] = []; Object.keys(frequencyOfMostFrequentBins).forEach(function (primaryKey, valindex) { let obj: any = {}; - obj["primaryKey"] = primaryKey; - obj["value"] = context.rawData[valindex]; - obj["binCandidates"] = []; - - Object.keys(binningMethodObjs).forEach(function (binningMethod) { - obj["binCandidates"].push(JSON.parse(JSON.stringify(binningMethodObjs[binningMethod]["dataBinAssignments"][primaryKey]))); - }); - resiliencyData.push(obj); + if(context.isValid(context.rawData[valindex])){ + obj["primaryKey"] = primaryKey; + obj["value"] = context.rawData[valindex]; + obj["binCandidates"] = []; + + Object.keys(binningMethodObjs).forEach(function (binningMethod) { + obj["binCandidates"].push(JSON.parse(JSON.stringify(binningMethodObjs[binningMethod]["dataBinAssignments"][primaryKey]))); + }); + resiliencyData.push(obj); + } }); let itemwiseBinPriorities: any = {};