-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
[CLEANUP Beta] Cleanup Ember.get #11746
Conversation
@@ -51,6 +51,8 @@ export let UNHANDLED_GET = symbol('UNHANDLED_GET'); | |||
@public | |||
*/ | |||
export function get(obj, keyName) { | |||
Ember.assert(`Get must be called with two arguments; an object and a property key`, arguments.length >= 2); | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that _getPath
(here), calls get with three arguments, can anyone explain me why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like it should not.
|
@@ -51,24 +50,17 @@ export let UNHANDLED_GET = symbol('UNHANDLED_GET'); | |||
@public | |||
*/ | |||
export function get(obj, keyName) { | |||
Ember.assert(`Get must be called with two arguments; an object and a property key`, arguments.length === 2); | |||
Ember.assert(`Cannot call get with '${keyName}' on an undefined object.`, obj !== undefined && obj !== null); | |||
Ember.assert(`Cannot call get with ${keyName} key.`, typeof keyName === 'string'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This assertion could be clearer with something like The key provided to get must be a string, you passed ${keyName}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just took the existing message. But if that's better I could change it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like a good improvement
This is sweet 👏 |
|
Lgtm |
@rwjblue please suggest squash or merge if you are happy as is. |
- Removes support for global lookup with get. - Removes support for get with this in paths. - Removes support for get with null as first parameter. - Adds an assertion that get always has to be called with two parameters.
I squashed all but one commit. |
[CLEANUP Beta] Cleanup Ember.get
Resolves #11733