Skip to content
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

Injecting falsy values #5043

Closed
znck opened this issue Mar 1, 2017 · 5 comments
Closed

Injecting falsy values #5043

znck opened this issue Mar 1, 2017 · 5 comments

Comments

@znck
Copy link
Member

znck commented Mar 1, 2017

Version

2.2.1

Reproduction Link

https://jsfiddle.net/agvmLg8t/1/

Steps to Reproduce

  • View generated output

What is expected?

Provided falsy values should be injectable.

What is actually happening?

Check in inject.js#L16 prevents injection of falsy values.

@LinusBorg
Copy link
Member

LinusBorg commented Mar 1, 2017

if (source._provided && typeof source._provided[provideKey] !== 'undefined') {

should be enough, right?

@znck
Copy link
Member Author

znck commented Mar 1, 2017

in check would handle cases like provide: { foo: undefined }

@Akryum
Copy link
Member

Akryum commented Mar 1, 2017

Or provide.hasOwnProperty? https://jsfiddle.net/Akryum/y7Lfa58j/

@znck
Copy link
Member Author

znck commented Mar 1, 2017

hasOwnProperty ignores inherited properties.

I guess inherited properties are not required in our case. Should it be changed to hasOwnProperty?

@posva
Copy link
Member

posva commented Mar 1, 2017

I like the fact that in makes a shorter version 😆 Just ping Evan on the PR 🙂

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

No branches or pull requests

4 participants