Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | 156x 156x 24232x 473x 3714x 40x 10x 10x 10x | import {printTree} from 'tree-dump/lib/printTree'; import type {AnyExtension} from './Extension'; import type {Printable} from 'tree-dump/lib/types'; export class Extensions implements Printable { protected readonly ext: Record<number, AnyExtension> = {}; public register(extension: AnyExtension) { this.ext[extension.id] = extension; } public get(id: number): AnyExtension | undefined { return this.ext[id]; } public size(): number { return Object.keys(this.ext).length; } public clone(): Extensions { const clone = new Extensions(); for (const ext of Object.values(this.ext)) clone.register(ext); return clone; } public toString(tab: string = ''): string { const keys = Object.keys(this.ext) .map((k) => +k) .sort(); return ( 'extensions' + printTree( tab, keys.map((k) => (tab) => `${k}: ${this.ext[k].name}`), ) ); } } |