Recent

Custom Controls Using Angular Material

Git Repo:  https://github.com/yawahang/ohcontrols Features DatePicker (Date Picker, Time Picker, Date Time Picker, and many more) RatingPicker (Vertical, Horizontal, Custom Icons) Select (Single Select, MultiSelect, Single Column, MultiColumn) Recursive Treeview

Merge two array of objects, removes duplicate objects


/*
     !Merge two array of objects, removes duplicate objects
     =======================================
     Implementation:
                     arrayObj1  = [{name:"a"},{name:"b"}];
                     arrayObj2  = [{name:"a"},{name:"c"}];
                     mergedArrayObj = uniqueMergeArrayObj(arrayObj1, arrayObj2);
                    //* Output: [{name:"a"},{name:"b"},{name:"c"}]
  */
  uniqueMergeArrayObj(arr1any[], arr2?: any[]) {

    const duplicateArray = [...arr1, ...arr2];
    return [...new Set(duplicateArray.map(o => JSON.stringify(o)))].map(s => JSON.parse(s));
  }

Comments

Top Posts

SQL Server Symmetric Key & Certificate based Encryption With AES_256 Algorithm

Kendo Grid Angular Column Width, minResizableWidth dynamic

Kendo Grid AutoFit Columns