SteveSanderson / knockout-es5

Knockout.js meets ECMAScript 5 properties
157 stars 39 forks source link

typeof fix #1

Closed arj03 closed 11 years ago

arj03 commented 11 years ago

Fixes passing an array or date to ko.track. I'm not 100% sure if they check should also be applied to the getObservable function.

SteveSanderson commented 11 years ago

Thanks.

Could you clarify what use case this change enables? It looks like it would block you from passing an array or date into ko.track, but under what scenario would somebody be doing that anyway?

arj03 commented 11 years ago

Someone not reading the documentation :-) I was looking at the code and the check just looked wrong, I have been bitten by the typeof error before ;-)

SteveSanderson commented 11 years ago

OK, I'll close this, but let me know if you think of another reason why it should be changed :)

Thanks

arj03 commented 11 years ago

Well I'm wondering what the original check was for, if it was not for giving a proper error to people who havn't read the documentation? It must have worked for ordinary numbers, but it would make sense that it also worked for arrays.

At least, as it is now it seems incomplete. In which case it seems better to remove the two line check altogether.