@pengzhanbo/utils - v3.7.3
    Preparing search index...

    Function isPromise

    • Checks if the input is a Promise.

      检查输入是否为 Promise。

      Type Parameters

      • T = unknown

        The type of the Promise resolution value / Promise 解析值的类型

      Parameters

      • v: unknown

        The value to check. 要检查的值

      Returns v is Promise<T>

      True if the value is a Promise, false otherwise. 如果值为 Promise 则返回 true,否则返回 false

      This function relies on instanceof operator, which fails for promises originating from different realms (e.g., iframes or separate VM contexts). It does not detect "thenable" objects (objects with a then method that behave like promises).

      该函数依赖于 instanceof 运算符,对于来自不同环境(例如 iframe 或独立 VM 上下文)的 Promise 无法检测。 它检测 "thenable" 对象(具有 then 方法并像 Promise 一样行为的对象)。

      isPromise(Promise.resolve()) // => true
      isPromise({}) // => false