-
Notifications
You must be signed in to change notification settings - Fork 16
Open
Description
Hi Team,
Please look at the below code segment from index.ts file. It's doing deserialisation twice per object because we are assigning the first element for deserialisation first and then the popped element again.
`const runDeserialization = (conversionFunctionStructures: ConversionFunctionStructure[]): void => {
const converstionFunctionsArray: Array<ConversionFunctionStructure> = [];
conversionFunctionStructures.forEach((struct: ConversionFunctionStructure) => {
converstionFunctionsArray.push(struct);
});
**let conversionFunctionStructure: ConversionFunctionStructure = converstionFunctionsArray[0];** //This line needs to be replaced with **let conversionFunctionStructure: ConversionFunctionStructure = (converstionFunctionsArray.length > 0)? converstionFunctionsArray.pop() : undefined;**
// tslint:disable-next-line:triple-equals
while (conversionFunctionStructure != undefined) {
const stackEntries: Array<ConversionFunctionStructure> = conversionFunctions[conversionFunctionStructure.functionName](
conversionFunctionStructure.instance, conversionFunctionStructure.instanceKey,
conversionFunctionStructure.type, conversionFunctionStructure.json,
conversionFunctionStructure.jsonKey);
stackEntries.forEach((structure: ConversionFunctionStructure) => {
converstionFunctionsArray.push(structure);
});
conversionFunctionStructure = converstionFunctionsArray.pop();
}
};`
siddie
Metadata
Metadata
Assignees
Labels
No labels