New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bluebird.props for empty Map returns an Object #1338

Closed
alanhoff opened this Issue Feb 13, 2017 · 4 comments

Comments

Projects
None yet
4 participants
@alanhoff

alanhoff commented Feb 13, 2017

  1. What version of bluebird is the issue happening on?
    v3.4.7

  2. What platform and version?
    v7.5.0
    Darwin Alans-MacBook-Pro.local 15.6.0 Darwin Kernel Version 15.6.0: Mon Jan 9 23:07:29 PST 2017; root:xnu-3248.60.11.2.1~1/RELEASE_X86_64 x86_64

  3. Did this issue happen with earlier version of bluebird?
    Yes

Bluebird.props should return an empty ES6 Map instead of a plain object {} when called with an empty Map:

screenshot 2017-02-13 15 10 54

@benjamingr

This comment has been minimized.

Show comment
Hide comment
@benjamingr

benjamingr Feb 14, 2017

Collaborator

I'm not sure I agree. Promise.props is just for returning multiple named values and passing it a map as configuration is a nice bonus - but Bluebird can't be expected to deal with every case.

Collaborator

benjamingr commented Feb 14, 2017

I'm not sure I agree. Promise.props is just for returning multiple named values and passing it a map as configuration is a nice bonus - but Bluebird can't be expected to deal with every case.

@alanhoff

This comment has been minimized.

Show comment
Hide comment
@alanhoff

alanhoff Feb 14, 2017

@benjamingr I don't think it's about dealing with every case (empty Map only?) but not being predictable is what hurts the most. I'm ok with it if we add it to the docs:

The promise's fulfilment value is an object or a Map with fulfilment values at respective keys to the original object or a Map unless it's an empty Map, in this case it will return an empty object.

Don't you think it seems highly inconvenient? The resolved value depends on the number of items inside a Map

alanhoff commented Feb 14, 2017

@benjamingr I don't think it's about dealing with every case (empty Map only?) but not being predictable is what hurts the most. I'm ok with it if we add it to the docs:

The promise's fulfilment value is an object or a Map with fulfilment values at respective keys to the original object or a Map unless it's an empty Map, in this case it will return an empty object.

Don't you think it seems highly inconvenient? The resolved value depends on the number of items inside a Map

@bsiddiqui

This comment has been minimized.

Show comment
Hide comment
@bsiddiqui

bsiddiqui Feb 14, 2017

@benjamingr seems like odd behavior that Promise.props called with a Map sometimes returns a Map and sometimes returns an Object.

You're totally right that passing it a map as a configuration is a nice bonus but feels like if Bluebird is going to include that functionality it should be consistent and predictable.

bsiddiqui commented Feb 14, 2017

@benjamingr seems like odd behavior that Promise.props called with a Map sometimes returns a Map and sometimes returns an Object.

You're totally right that passing it a map as a configuration is a nice bonus but feels like if Bluebird is going to include that functionality it should be consistent and predictable.

@spion

This comment has been minimized.

Show comment
Hide comment
@spion

spion Feb 15, 2017

Collaborator

👍 different return value types are strange

Collaborator

spion commented Feb 15, 2017

👍 different return value types are strange

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment