Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
getDiff: function (fromFile, fromSafe) {
var diffs = [];
if (fromFile.users)
fromFile = fromFile.users;
if (fromSafe.Response)
fromSafe = fromSafe.Response.EmployeeData.Employee;
for (let i = 0; i < fromFile.length; i++) {
let EmployeeType = fromFile[i].Level === "M" ? " Manager " : " Clerk ";
if (_.findWhere(fromSafe, {"Name": " " + fromFile[i].Name + " ", "EmployeeType": EmployeeType}) === undefined) {
diffs.push({
"EmployeeType": fromFile[i].Level === "M" ? "Manager" : "Clerk",
"Name": fromFile[i].Name,
"PIN": fromFile[i].PIN,
"action": "add"
});
}
}
for (let i = 0; i < fromSafe.length; i++) {
let EmployeeType = fromSafe[i].EmployeeType === " Manager " ? "M" : "C";
if (_.findWhere(fromFile, {"Name": fromSafe[i].Name.trim(), "Level": EmployeeType}) === undefined) {
diffs.push({
"EmployeeType": fromSafe[i].EmployeeType,
"Name": fromSafe[i].Name,
"action": "delete"
});
}
}
return diffs;
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.