UNPKG

@pureweb/platform-streaming-agent

Version:

The PureWeb platform streaming agent enables your game to communicate and stream through the PureWeb Platform

36 lines (35 loc) 718 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Bimap = void 0; class Bimap { constructor() { this.kv = new Map(); this.vk = new Map(); } set(k, v) { if (!this.kv.has(k)) { this.kv.set(k, v); this.vk.set(v, k); } } delete(k) { const v = this.kv.get(k); if (v) { this.kv.delete(k); this.vk.delete(v); } } valueForKey(k) { return this.kv.get(k); } hasKey(k) { return this.kv.has(k); } keyForValue(v) { return this.vk.get(v); } hasValue(v) { return this.vk.has(v); } } exports.Bimap = Bimap;