@microsoft/compose-language-service
Version:
Language service for Docker Compose documents
24 lines • 799 B
JavaScript
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See LICENSE.md in the project root for license information.
*--------------------------------------------------------------------------------------------*/
export 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;
}
}
//# sourceMappingURL=Lazy.js.map