UNPKG

@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.

59 lines (56 loc) 1.18 kB
'use strict'; // src/common-js/EnhancedMap.ts var defaultCompareFn = (a, b) => { if (a < b) { return false; } if (a > b) { return true; } return false; }; var EnhancedMap = class { map; compareFn; getKey = (a, b) => { const key = this.compareFn(a, b) ? `${a}_${b}` : `${b}_${a}`; return key; }; get size() { return this.map.size; } get data() { return this.map; } get = (a, b) => { const key = this.getKey(a, b); const value = this.map.get(key); return value; }; values = () => { return this.map.values(); }; set = (a, b, value) => { const key = this.getKey(a, b); this.map.set(key, value); return value; }; delete = (a, b) => { const key = this.getKey(a, b); return this.map.delete(key); }; has = (a, b) => { const key = this.getKey(a, b); return this.map.has(key); }; clear = () => { this.map.clear(); }; constructor(data) { this.map = /* @__PURE__ */ new Map(); if (data.compareFn) this.compareFn = data.compareFn; else this.compareFn = defaultCompareFn; } }; exports.EnhancedMap = EnhancedMap; exports.defaultCompareFn = defaultCompareFn;