Consider the following array of employee data:
var service = [{
AssignedEmployeeInternalID: "8000000011",
AssignedEmployeeUUID: "00000000-0001-1EE1-82C1-8379F1C4462E",
BillableIndicator: true,
BusinessPartnerFormattedName: "Sébastien Brun",
EndDateTime: null,
EndDatetimeZoneCode: "UTC",
Info: "-N/A",
InternalID: "",
ObjectID: "00163E0E46241EE988E20C5E4033E0BE",
ParentObjectID: "00163E0306801ED287F1C8E9CDFA9E4A",
PeriodPlansArray: [],
PlannedWorkQuantity: "0.00000000000000",
PlannedWorkQuantityunitCode: "HUR",
PlannedWorkQuantityunitCodeText: "",
},
{
AssignedEmployeeInternalID: "8000000011",
AssignedEmployeeUUID: "00000000-0001-1EE1-82C1-8379F1C4462E",
BillableIndicator: false,
BusinessPartnerFormattedName: "Sébastien Brun",
EndDateTime: null,
EndDatetimeZoneCode: "UTC",
Info: "-N/A",
InternalID: "",
ObjectID: "00163E0E46241EE988E20C5E4033E0BE",
ParentObjectID: "00163E0306801ED287F1C8E9CDFA9E4A",
PeriodPlansArray: [],
PlannedWorkQuantity: "0.00000000000000",
PlannedWorkQuantityunitCode: "HUR",
PlannedWorkQuantityunitCodeText: "",
},
{
AssignedEmployeeInternalID: "8000000011",
AssignedEmployeeUUID: "00000000-0001-1EE1-82C1-8379F1C4462E",
BillableIndicator: true,
BusinessPartnerFormattedName: "Sébastien Brun",
EndDateTime: null,
EndDatetimeZoneCode: "UTC",
Info: "-N/A",
InternalID: "",
ObjectID: "00163E0E46241EE988E20C5E4033E0BE",
ParentObjectID: "00163E0306801ED287F1C8E9CDFA9E4A",
PeriodPlansArray: [],
PlannedWorkQuantity: "0.00000000000000",
PlannedWorkQuantityunitCode: "HUR",
PlannedWorkQuantityunitCodeText: "",
}
]
To confirm that AssignedEmployeeInternalID
is consistent across all elements in the array, you can use the following approach:
result = _.differenceBy(service, [{ 'AssignedEmployeeInternalID': service[0].AssignedEmployeeInternalID }], 'AssignedEmployeeInternalID');
If you are unsure of the value to exclude (the specific AssignedEmployeeInternalID), and want to dynamically verify that all properties are the same, you can implement a more dynamic solution.