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 | 10x 62x 7x | import type Context from "./context";
import type { ReportNode, Summarizers } from "./summarizer-factory";
import type { PartialVisitor } from "./tree";
// TODO: switch to class private field when targeting node.js 12
const _summarizer: unique symbol = Symbol("ReportBase.#summarizer");
/** options accepted by {@link ReportBase} */
export interface ReportBaseOptions {
/** the summarizer strategy to use when executing the report */
summarizer?: Summarizers;
}
class ReportBase {
declare private [_summarizer]: Summarizers | undefined;
constructor(opts: ReportBaseOptions = {}) {
this[_summarizer] = opts.summarizer;
}
execute(context: Context): void {
context.getTree(this[_summarizer]).visit(this as PartialVisitor<ReportNode>, context);
}
}
export default ReportBase;
|