@huddle01/web-core
Version:
The Huddle01 Javascript SDK offers a comprehensive suite of methods and event listeners that allow for seamless real-time audio and video communication with minimal coding required.
54 lines (50 loc) • 1.06 kB
JavaScript
'use strict';
require('../chunk-N254NRHT.cjs');
// src/common-js/EnhancedSet.ts
var defaultCompareFn = (a, b) => {
if (a < b) {
return false;
}
if (a > b) {
return true;
}
return false;
};
var EnhancedSet = class {
set;
compareFn;
getKey = (a, b) => {
const key = this.compareFn(a, b) ? `${a}_${b}` : `${b}_${a}`;
return key;
};
data = () => {
return this.set;
};
get size() {
return this.set.size;
}
has = (a, b) => {
const key = this.getKey(a, b);
const value = this.set.has(key);
return value;
};
add = (a, b) => {
const key = this.getKey(a, b);
this.set.add(key);
return key;
};
delete = (a, b) => {
const key = this.getKey(a, b);
return this.set.delete(key);
};
clear = () => {
this.set.clear();
};
constructor(data) {
this.set = /* @__PURE__ */ new Set();
if (data.compareFn) this.compareFn = data.compareFn;
else this.compareFn = defaultCompareFn;
}
};
exports.EnhancedSet = EnhancedSet;
exports.defaultCompareFn = defaultCompareFn;