import { stringify } from '../JSON' export function getSymmetricMap(forward: Map) { const result: Map = new Map() const entries = forward.entries() for (const entry of entries) { const [from, to] = entry if (result.has(to)) throw new Error(`Duplicate key detected: ${stringify(to)}`) result.set(to, from) } return result }