-
Notifications
You must be signed in to change notification settings - Fork 286
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
Fix Ember.typeof replace with custom typeof #1052
Conversation
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.
@patricklx if we are introducing a custom typeOf
I think we should add some unit tests to make sure everything evaluates to the types we expect. Thoughts?
You already have:
Though i could add one more for async function |
mmm, I would add the test for async func after I rebase once/if this is merged. since currently functions are ignored by the object-inspector |
ember_debug/utils/type-check.js
Outdated
|
||
|
||
export function typeOf(obj) { | ||
return ({}).toString.call(obj).match(/\s([a-zA-Z]+)/)[1].toLowerCase(); |
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.
Won't this be brittle, since toString
can be overridden?
@patricklx will this work back to Ember 3.4 without the |
yes, since |
* replace Ember.typeOf with own simple typeof * Update mixin.scss * fix comments * use Object.prototype * fix quotes * detect asyncfunction as function * fix * fix * last fix
* replace Ember.typeOf with own simple typeof * Update mixin.scss * fix comments * use Object.prototype * fix quotes * detect asyncfunction as function * fix * fix * last fix
* replace Ember.typeOf with own simple typeof * Update mixin.scss * fix comments * use Object.prototype * fix quotes * detect asyncfunction as function * fix * fix * last fix
mainly to support detecting async function.
type-instance
andtype-class
will be gone. (class probably never happend)