travis-web/app/utils/eventually.js
Piotr Sarnacki 59747f8424 Handle promises properly
With API V3 we have some relationships (like lastBuild on branch)
specified as asynchronuous, so sometimes we may deal with promises. This
commit fixes the situation by handling both plain records and promises.
2016-04-07 08:48:03 +02:00

10 lines
218 B
JavaScript

export default function(anObjectOrAPromise, callback) {
if(anObjectOrAPromise.then) {
anObjectOrAPromise.then(function(result) {
callback(result);
});
} else {
callback(anObjectOrAPromise);
}
}