In my current project, I am working with an array named props
which consists of multiple arrays containing objects. Each object within these arrays has four properties: participation_enabled
, name
, pathing_enabled
, and id
. These properties can have varying values across different arrays.
My main objectives are twofold:
1) Identify all the object properties that differ among the arrays and store them in a separate array called diffs;
2) Find any extra objects (unique id
) that do not exist in other arrays and store them in an array named extra.
While my code successfully captures the differences, it currently falls short in identifying all the extra objects...
For instance, consider the following example:
[
[
{participation_enabled:"false", name:"PropEins", pathing_enabled:"true", id:"prop1"},
{participation_enabled:"false", name:"User Status", pathing_enabled:"false", id:"prop2"},
{participation_enabled:"false", name:"Initial ID", pathing_enabled:"false", id:"prop3"},
{participation_enabled:"false", name:"User ID", pathing_enabled:"false", id:"prop4"},
{participation_enabled:"false", name:"Subdomain3", pathing_enabled:"false", id:"prop20"},
{participation_enabled:"false", name:"Subdomain4", pathing_enabled:"false", id:"prop21"},
{participation_enabled:"false", name:"Subdomain5", pathing_enabled:"false", id:"prop22"}
],
...
]
The resulting diffs
array from this example should include:
[
...
]
Additionally, the extra
array should capture:
[
...
]
This excerpt features my original implementation code:
...