updates to concierge bot to support adding services and routes
This commit is contained in:
10
packages/lib/src/util/promise.ts
Normal file
10
packages/lib/src/util/promise.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
export function isPromise<T>(value: T | Promise<T>): value is Promise<T> {
|
||||
return typeof (value as Promise<T>)?.then === 'function';
|
||||
}
|
||||
|
||||
export async function awaitMaybePromise<T>(value: T | Promise<T>) {
|
||||
if (isPromise(value)) {
|
||||
return await value;
|
||||
}
|
||||
return Promise.resolve(value);
|
||||
}
|
||||
Reference in New Issue
Block a user