diff --git a/Array.js b/Array.js index 647e12d..63e29fb 100644 --- a/Array.js +++ b/Array.js @@ -489,11 +489,13 @@ object.Mixin('ArrayProtoMixin', 'soft', { // -> iterator // // XXX should this take an argument and be like map?? + // XXX this should handle throwing STOP!!! iter: function*(handler=undefined){ if(handler){ var i = 0 for(var e of this){ var res = handler.call(this, e, i++) + // treat non-iterables as single elements... if(typeof(res) == 'object' && Symbol.iterator in res){ yield* res