Skip to content

Instantly share code, notes, and snippets.

@Lodo4ka
Created September 20, 2018 08:44
Show Gist options
  • Save Lodo4ka/4ad739776e257213a2b8d69aaa47d2b8 to your computer and use it in GitHub Desktop.
Save Lodo4ka/4ad739776e257213a2b8d69aaa47d2b8 to your computer and use it in GitHub Desktop.
function pushUniqueObject(...arrays) {
let result = [];
let uniqueId = [];
for(let array of arrays) {
if(array.length !== 0) {
for (let object of array) {
if(object.child_id !== undefined && !uniqueId[object.child_id]) {
uniqueId[object.child_id] = true;
result.push(object);
}
}
}
}
return result;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment