From 69b93951bd2ddb3e6b5d9357fc34e3098f3709cc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C3=ABl=20Minelli?= <michael@minelli.me>
Date: Mon, 3 Jul 2023 23:26:55 +0200
Subject: [PATCH] LazyVal => Add possibility to give directly the value

---
 helpers/LazyVal.ts | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/helpers/LazyVal.ts b/helpers/LazyVal.ts
index cd97f68..0217647 100644
--- a/helpers/LazyVal.ts
+++ b/helpers/LazyVal.ts
@@ -1,11 +1,11 @@
 class LazyVal<T> {
     private val: T = null;
 
-    constructor(private valLoader: () => Promise<T>) {}
+    constructor(private valLoader: () => Promise<T> | T) {}
 
     get value(): Promise<T> {
         return new Promise<T>(async (resolve) => {
-            if (this.val === null) {
+            if ( this.val === null ) {
                 this.val = await this.valLoader();
             }
 
-- 
GitLab