rtfeldman/seamless-immutable

Incorrectly identifying promises

Open

#208 geöffnet am 18. März 2017

Auf GitHub ansehen
 (6 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)JavaScript (221 Forks)batch import
bughelp wanted

Repository-Metriken

Stars
 (5.367 Stars)
PR-Merge-Metriken
 (Keine gemergten PRs in 30 T)

Beschreibung

I've encountered an issue in the latest (7.1.0) release relating to commit 492d53e705acb6c

The issue is that isPromise makes a huge assumption that any object with a then method is a Promise. If the object is not a Promise, then will be called which may not be desirable.

This can be demonstrated very simply

Immutable({then:function() { console.log("should not be called") }});

I encountered this when using superagent which provides a thenable interface but is not technically a Promise. I suspect there may well be other libraries with a similar approach.

Contributor Guide