UNPKG

@yuebai008/cli

Version:

Command line interface for rapid qg-minigame development

1 lines 342 B
export class CharacterIdMap{#e;#t;#r;constructor(){this.#e=new Map,this.#t=new Map,this.#r=33}toChar(e){let t=this.#e.get(e);if(!t){if(this.#r>=65535)throw new Error("CharacterIdMap ran out of capacity!");t=String.fromCharCode(this.#r++),this.#e.set(e,t),this.#t.set(t,e)}return t}fromChar(e){const t=this.#t.get(e);return void 0===t?null:t}}