Function isPromise

  • 检查是否为 Promise

    Parameters

    • value: any

    Returns boolean

    isPromise(function(){}); /// false
    isPromise(async function(){}); /// false
    isPromise(new Promise((resolve, reject) => resolve())); /// true