Javascript — Identify a promise object

You can use the fol­low­ing func­tion to deter­mine if the given object is promise object or not.

function isPromise (p) {
    return (typeof p.then === 'function') ? true : false; 
}

You may also like...