Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Multiple Different Implementations of isPromiseLike() #13372

Open
@aebabis

Description

@aebabis

promises-aplus-test-adapter uses the following code to determine if an object is promise-like:

var isPromiseLike = function isPromiseLike(obj) {return obj && isFunction(obj.then);};

ngAnimate does this:

var isPromiseLike = function(p) {
    return p && p.then ? true : false;
};

and Angular.js does this:

function isPromiseLike(obj) {
    return obj && isFunction(obj.then);
}

Perhaps they should all be changed to this:

function isPromiseLike(obj) {
    return obj && typeof obj.then === 'function';
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions