(function (window) {
var Utils = {
TODO determines if two JSON is equal
Equals:function (param, param2) {
return json.stringify (param) = = = Json.stringify (param2);
},
TODO gets the number of occurrences of the current item in the array
Getcountbyitem:function (Objects,item) {
var count = 0;
for (var i = 0;i < objects.length;i++) {
if (This.equals (Objects[i], item)) {
count++;
}
}
return count;
},
TODO gets a list of items with two array intersections and supports the List<object> code format: [{}]
Getrepeatitems:function (objects,objects2) {
var tempobjects = Objects.concat (OBJECTS2);
var repeatitems = [];
for (var i = 0;i < tempobjects.length;i++) {
var itemCount = This.getcountbyitem (Tempobjects,tempobjects[i]);
if (ItemCount > 1) {
Repeatitems.push (Tempobjects[i]);
Tempobjects[i] = null;
}
}
return repeatitems;
}
};
Window. Utils = Utils;
}) (window);
Javascript gets a list of two array intersection (duplicates) of items, supporting list<object>