{"version":3,"file":"set.cjs","names":[],"sources":["../../src/util/set.ts"],"sourcesContent":["/**\n * Source: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set#implementing_basic_set_operations\n */\n\n/**\n * returns intersection of two sets\n */\nexport function intersection<T>(setA: Set<T>, setB: Set<T>) {\n  const _intersection = new Set<T>();\n  for (const elem of setB) {\n    if (setA.has(elem)) {\n      _intersection.add(elem);\n    }\n  }\n  return _intersection;\n}\n\n/**\n * returns union of two sets\n */\nexport function union<T>(setA: Set<T>, setB: Set<T>) {\n  const _union = new Set(setA);\n  for (const elem of setB) {\n    _union.add(elem);\n  }\n  return _union;\n}\n\n/**\n * returns difference of two sets\n */\nexport function difference<T>(setA: Set<T>, setB: Set<T>) {\n  const _difference = new Set(setA);\n  for (const elem of setB) {\n    _difference.delete(elem);\n  }\n  return _difference;\n}\n"],"mappings":";;;;;;;AAOA,SAAgB,aAAgB,MAAc,MAAc;CAC1D,MAAM,gCAAgB,IAAI,KAAQ;AAClC,MAAK,MAAM,QAAQ,KACjB,KAAI,KAAK,IAAI,KAAK,CAChB,eAAc,IAAI,KAAK;AAG3B,QAAO;;;;;AAMT,SAAgB,MAAS,MAAc,MAAc;CACnD,MAAM,SAAS,IAAI,IAAI,KAAK;AAC5B,MAAK,MAAM,QAAQ,KACjB,QAAO,IAAI,KAAK;AAElB,QAAO;;;;;AAMT,SAAgB,WAAc,MAAc,MAAc;CACxD,MAAM,cAAc,IAAI,IAAI,KAAK;AACjC,MAAK,MAAM,QAAQ,KACjB,aAAY,OAAO,KAAK;AAE1B,QAAO"}