Closed yuvaldim closed 10 years ago
Couple of points:
On Sat, Oct 4, 2014 at 2:29 AM, Guy notifications@github.com wrote:
@yuvaldim https://github.com/yuvaldim Checking hasOwnProperty() in every loop makes the code cluttered, and it's only relevant when using prototype inheritance, which is not the case for all these cases. In general I think this loop+check pattern makes the code harder to read more than the protection it provides. If you really think that we should protect against future inheritance of these collections then I suggest to use _.each(function(x){}) as standard instead which is cleaner.
— Reply to this email directly or view it on GitHub https://github.com/noobaa/noobaa/pull/164#issuecomment-57880622.
smile, you don't have much left La-Dimnik ;)
.each is probably safe BUT it introuces a bigger change then I intended. As that is the case I'll merge what I've done. From this point on - for (x in y) should use .each...
@yuvaldim Checking hasOwnProperty() in every loop makes the code cluttered, and it's only relevant when using prototype inheritance, which is not the case for all these cases. In general I think this loop+check pattern makes the code harder to read more than the protection it provides. If you really think that we should protect against future inheritance of these collections then I suggest to use _.each(function(x){}) as standard instead which is cleaner.