*add new helper maybeGetAsyncProperty to process the kernel client proxies if needed

This commit is contained in:
Derrick Hammer 2023-03-25 10:50:39 -04:00
parent 6323bc6b29
commit 5e4617ac55
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 12 additions and 0 deletions

View File

@ -125,3 +125,15 @@ export function setupStream(stream: any) {
return stream[RPC_PROTOCOL_SYMBOL];
}
export async function maybeGetAsyncProperty(object: any) {
if (typeof object === "function") {
object = object();
}
if (isPromise(object)) {
object = await object;
}
return object;
}