/** * @author Martin Karkowski * @email m.karkowski@zema.de * @create date 2021-03-11 17:17:50 * @modify date 2021-03-11 17:17:50 * @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(set02); for (const item of removed) { if (!set01.has(item)) { added.add(item); } else { // Delete the element, because it is available. removed.delete(item); } } return { added, removed }; }