import {ParsedObjectType} from "../../../types/ParsedObjectType"; import {equalTypes} from "../../../comparer/equalTypes"; //Assuming the function gets consolidated objects export function areObjectsEqual(objectA: ParsedObjectType, objectB: ParsedObjectType) : boolean { const objectAItemsLength = objectA.items.length; if (objectAItemsLength !== objectB.items.length) { return false; } for (let i=0; i < objectAItemsLength; i++){ let currentItem = objectA.items[i]; let itemToCompare = objectB.items[i]; const areTheKeysSame = currentItem.key._type === itemToCompare.key._type && equalTypes(currentItem.key, itemToCompare.key); if (!areTheKeysSame){ return false } const areTheValuesEqual = equalTypes(currentItem.value, itemToCompare.value); if (!areTheValuesEqual) { return false; } } return true; }