常用判断函数

Published: · LastMod: November 18, 2021 · 27 words

是否是promise 🔗

1
2
3
export function isPromise(object: any): object is Promise<any> {
  return Promise.resolve(object) === object;
}