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

[BUGFIX beta] Enable @ember/object#get to be called with an empty string #16870

Merged
merged 1 commit into from
Aug 8, 2018
Merged

[BUGFIX beta] Enable @ember/object#get to be called with an empty string #16870

merged 1 commit into from
Aug 8, 2018

Conversation

nlfurniss
Copy link
Contributor

@nlfurniss nlfurniss commented Aug 7, 2018

In plain JS, this works just fine

let myObj = {
  '': 'true'
};

myObj['']; // true

However Ember throws an error if you do: get(myObj, ''). Spoke with @chancancode and he told me that previously there was a bug where calling get with an empty string would return myObj. However, this has been fixed at some point and it seems like this should work in Ember.

  • Remove keyName !== '' assertion
  • Add test to ensure calling get with empty string returns a value if the key '' exists
  • Add test to ensure calling get with empty string returns undefined if the key '' doesn't exist
  • Add tests to ensure {{each-in}} renders items when the hash has a key of empty string

@chancancode
Copy link
Member

r? @rwjblue

@rwjblue rwjblue changed the title Enable @ember/object#get to be called with an empty string [BUGFIX beta] Enable @ember/object#get to be called with an empty string Aug 8, 2018
@rwjblue rwjblue merged commit 223dc58 into emberjs:master Aug 8, 2018
@nlfurniss nlfurniss deleted the let-get-empty-string branch August 8, 2018 03:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants