UNPKG

@microsoft/compose-language-service

Version:
28 lines 913 B
"use strict"; /*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See LICENSE.md in the project root for license information. *--------------------------------------------------------------------------------------------*/ Object.defineProperty(exports, "__esModule", { value: true }); exports.Lazy = void 0; class Lazy { valueFactory; /* private */ #value; constructor(valueFactory) { this.valueFactory = valueFactory; } get value() { if (this.#value === undefined) { this.#value = this.valueFactory(); } return this.#value; } hasValue() { return (this.#value !== undefined); } clear() { this.#value = undefined; } } exports.Lazy = Lazy; //# sourceMappingURL=Lazy.js.map