mirror of
https://github.com/flynx/types.js.git
synced 2025-10-29 02:20:07 +00:00
fixed Array.prototype.iter(..)
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
1cc4e127f2
commit
7f80627670
7
Array.js
7
Array.js
@ -24,6 +24,9 @@ var STOP =
|
||||
module.STOP =
|
||||
object.STOP
|
||||
|
||||
var stoppable =
|
||||
module.stoppable =
|
||||
generator.stoppable
|
||||
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
@ -492,7 +495,7 @@ object.Mixin('ArrayProtoMixin', 'soft', {
|
||||
// XXX this should handle throwing STOP!!!
|
||||
// ...might also ne a good idea to isolate the STOP mechanics
|
||||
// into a spearate module/package...
|
||||
iter: function*(handler=undefined){
|
||||
iter: stoppable(function*(handler=undefined){
|
||||
if(handler){
|
||||
var i = 0
|
||||
for(var e of this){
|
||||
@ -504,7 +507,7 @@ object.Mixin('ArrayProtoMixin', 'soft', {
|
||||
} else {
|
||||
yield res } }
|
||||
} else {
|
||||
yield* this }},
|
||||
yield* this }}),
|
||||
|
||||
|
||||
// Stoppable iteration...
|
||||
|
||||
@ -86,6 +86,7 @@ var ITERATOR_PROTOTYPES = [
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
|
||||
// XXX should this be part of object???
|
||||
var stoppable =
|
||||
module.stoppable =
|
||||
function(func){
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user