Here's a quick solution without needing Lodash or other libraries:
function areObjectsEqual(a: any, b: any): boolean {
return (
JSON.stringify(a, Object.keys(a).sort()) ===
JSON.stringify(b, Object.keys(b).sort())
);
}
This can also handle nested objects and different order of properties.