/** * @author Martin Karkowski * @email m.karkowski@zema.de * @desc [description] */ /** * Helper Function which will determine the Difference between set01 and set02. * If values are in set02 and not in set01 they will be putted into added. If * items are in set01 but not in set02 they will be added to removed. * * @export * @template T * @param {Set} set01 Base Set * @param {Set} set02 Set to compare it with * @return {*} */ export function determineDifference( set01: Set, set02: Set ): { added: Set; removed: Set; } { const added = new Set(); const removed = new Set(); // We iterate over the set01 and // set02. If elements of set01 arent // present in set02 => they have been // removed for (const item of set01) { if (!set02.has(item)) { removed.add(item); } } // If elements of set02 arent // present in set01 => they have been // added for (const item of set02) { if (!set01.has(item)) { added.add(item); } } return { added, removed, }; }