0

I have Bluebird promise:

return Promise.props({
    something: getSomething() // returns 2
})
.then(function (data) {
    return {
        a: 1,
        b: data.something
    };
});

I expect to get: { a: 1, b: 2 }

But I get instead a Promise, why's that?

{
    isFulfilled: false
    isRejected: false
}
Szymon Toda
  • 4,454
  • 11
  • 43
  • 62
  • 2
    Yes then returns a promise. Otherwise how would you chain off it? The value you return is the value of the promise then returns not the value of the then. –  Jun 29 '15 at 11:51
  • @torazaburo and how to get it's value? `.value()` can not be used as am not knowing when Promise fulfills https://github.com/petkaantonov/bluebird/blob/master/API.md#value---dynamic – Szymon Toda Jun 29 '15 at 11:52
  • 1
    @Ultra: Just use another `then` callback… Notice that you can only consume promises asynchronously. – Bergi Jun 29 '15 at 13:02
  • 1
    You get its value by doing `promise.then(function(value) { /* value is the value */ })`. –  Jun 29 '15 at 13:02
  • http://stackoverflow.com/a/30180679/1348195 – Benjamin Gruenbaum Jun 29 '15 at 13:56

0 Answers0