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

    Function isPromiseLike

    • Checks if the input is a Promise-like object.

      检查输入是否为 Promise 类似对象。

      Type Parameters

      • T = unknown

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

      Parameters

      • v: unknown

        The value to check. 要检查的值

      Returns v is PromiseLike<T>

      True if the value is a Promise-like object, false otherwise. 如果值为 Promise 类似对象则返回 true,否则返回 false

      This function checks if the value has a then method that is a function.

      该函数检查值是否有 then 方法且该方法是一个函数。

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