This repository has been archived by the owner on Jul 30, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 58
Concerns regarding lang's internal isObject function #45
Comments
I tried to "break" |
Thanks for thinking to test Symbols; I neglected those. As far as I can tell, this rather ugly method is the most reliable means of correctly determining whether something is a POJO. |
It's way less ugly than the song-that-never-ends that the current code would be tending towards :P and I've seen it elsewhere, I just always forget about it. |
I'm more concerned that @mwistrand used "POJO" than I am with using this method... |
jdonaghue
added a commit
to jdonaghue/core
that referenced
this issue
Jul 15, 2015
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
This function is used to determine when something should be copied/assigned recursively. It currently returns true for things that report
typeof
asobject
that are not Arrays or RegExps. But I would think there are other things (e.g. Date) that should also return false here.@mwistrand suggested
Object.prototype.toString.call(item) === '[object Object]'
as a possible alternative that would avoid this slippery slope. Can anyone think of a reason that would be undesirable?The text was updated successfully, but these errors were encountered: