medikoo / dbjs

In-Memory Database Engine for JavaScript
MIT License
28 stars 4 forks source link

Map and Set iterator methods should iterate only over own properties #65

Open medikoo opened 8 years ago

medikoo commented 8 years ago

Currently implemented idea is that forEach, some etc. iterate also over properties that come from prototypes (e.g. to also provide getter values). Still it proved to be very problematic for implementation internals and it's also not on par with how language iterators work, therefore confusing.

The case of nested and multiple should work same. So if object has non of them resolved to the moment, it should be saturated with those before iteration. For that we may provide also saturate method that's invoked upfront, or even better, a method that will return list of all keys that should be iterated (then iterated keys will be resolved on the go, it's more optimal approach when some or every is concerned)