UNPKG

@bearz/ansi

Version:

The ansi module provides color detection, writing ansi, codes, and an ansi writer.

17 lines (16 loc) 302 B
export class Lazy { #value; #fn; constructor(fn) { this.#fn = fn; } get hasValue() { return this.#value != undefined; } get value() { if (this.#value == undefined) { this.#value = this.#fn(); } return this.#value; } }