• 0

Javascript - Identify a promise object

You can use the following function to determine if the given object is promise object or not.

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