immutable
immutable copied to clipboard
Add Iterators to object and array
As closely as possible, provide an Iterator interface for im.object and im.array. Including:
- Iteration over one element in a collection of n shouldn't incur O(n) penalty (i.e. no full mutable)
- Iterating over arrays should go from 0 -> .length - 1 inclusive
- Iterating over objects should iterate over all keys
- Where StopIteration is available, use it; where not, throw an error
Reference: http://wiki.ecmascript.org/doku.php?id=harmony:iterators