Skip to content

Instantly share code, notes, and snippets.

@termi
Last active August 29, 2015 14:05
Show Gist options
  • Save termi/66f16011c1a331faabc2 to your computer and use it in GitHub Desktop.
Save termi/66f16011c1a331faabc2 to your computer and use it in GitHub Desktop.

Revisions

  1. termi revised this gist Aug 22, 2014. 3 changed files with 139 additions and 123 deletions.
    251 changes: 133 additions & 118 deletions gen.es5.bt.js
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    var S_ITER$0 = typeof Symbol !== 'undefined' && Symbol.iterator || '@@iterator';
    var S_ITER$0 = typeof Symbol !== 'undefined' && Symbol && Symbol.iterator || '@@iterator';
    var S_MARK$0 = typeof Symbol !== 'undefined' && Symbol && Symbol["__setObjectSetter__"];
    function GET_ITER$0(v) {
    if( v ) {
    @@ -13,138 +13,153 @@ function GET_ITER$0(v) {
    if( (v + '') === '[object Generator]' )return v;
    }
    throw new Error(v + ' is not iterable')
    }
    };
    var $D$6;
    var $D$7;
    var $D$8;
    {
    var arr1 = [1, 2, 3], arr2 = [
    {a: 'a'},
    {a: 'b'},
    {a: 'c'}
    ];
    var gen = (function() {
    var Generator$0 = function Generator() {
    if( !(this instanceof Generator) )throw new TypeError();
    this["__next__"] = arguments[0];
    this["__throw__"] = arguments[1];
    };
    Generator$0.prototype = {constructor: Generator$0, "next": function(val) {
    if( this && this["__next__"] ) {
    try {
    return this["__next__"](val);
    } catch( e ) {
    if( this["__throw__"] )return this["__throw__"](e);
    else throw e;
    }
    }
    else return {"value": void 0, "done": true};
    }, "throw": function(e) {
    if( this["__throw__"] )return this["__throw__"](e);
    else throw e
    }, "toString": function() {
    return '[object Generator]'
    }};
    if( S_MARK$0 )S_MARK$0(Generator$0.prototype);
    Generator$0.prototype[typeof Symbol !== 'undefined' && Symbol && Symbol["toStringTag"] || '@@toStringTag'] = 'Generator';
    Generator$0.prototype[typeof Symbol !== 'undefined' && Symbol && Symbol["iterator"] || '@@iterator'] = function() {
    return this
    };
    if( S_MARK$0 )S_MARK$0(void 0);
    var $D$0;
    var $D$1;
    var $D$2;
    var $D$3;
    var $D$4;
    var $D$5;
    var x;
    var done$0 = false, throw$0 = false, throw_error$0;
    var init$0 = false;
    var init$1 = false;
    var state$0 = 1, next$0 = false;
    return new Generator$0(function next() {
    if( throw$0 === true ) {
    done$0 = true;
    var arr1 = [1, 2, 3], arr2 = [
    {a: 'a'},
    {a: 'b'},
    {a: 'c'}
    ];
    var gen = (function() {
    var S_STAG$0 = typeof Symbol !== 'undefined' && Symbol && Symbol["toStringTag"] || '@@toStringTag';
    var Generator$0 = function Generator() {
    if( !(this instanceof Generator$0) )throw new TypeError('incompatible' + this);
    this["__next__"] = arguments[0];
    this["__throw__"] = arguments[1];
    };
    Generator$0.prototype = {constructor: Generator$0, "next": function(val) {
    if( !(this instanceof Generator$0) )throw new TypeError('next method called on incompatible ' + this);
    if( this["__next__"] ) {
    try {
    return this["__next__"](val);
    } catch( e ) {
    if( this["__throw__"] )return this["__throw__"](e);
    else throw e;
    }
    if( done$0 === false ) {
    while( true ) {
    next$0 = false;
    switch( state$0 ) {
    case 1:
    if( init$0 === false ) {
    $D$0 = GET_ITER$0(arr1);
    $D$2 = $D$0 === 0;
    $D$1 = ($D$2 ? arr1.length : void 0);
    init$0 = true;
    }
    next$0 = $D$2 ? ($D$0 < $D$1) : !($D$1 = $D$0["next"]())["done"];
    if( next$0 ) {
    x = ($D$2 ? arr1[$D$0++] : $D$1["value"]);
    state$0 = 2;
    }
    else {
    break;
    }
    case 2:
    if( init$1 === false ) {
    var y = void 0;
    $D$3 = GET_ITER$0(arr2);
    $D$5 = $D$3 === 0;
    $D$4 = ($D$5 ? arr2.length : void 0);
    init$1 = true;
    }
    next$0 = $D$5 ? ($D$3 < $D$4) : !($D$4 = $D$3["next"]())["done"];
    if( next$0 ) {
    y = ($D$5 ? arr2[$D$3++] : $D$4["value"]).a;
    }
    else {
    state$0 = 1;
    init$1 = false;
    continue;
    }
    }
    if( next$0 ) {
    if( x != 2 ) {
    return {"value": x + y, "done": false};
    }
    else return {"value": void 0, "done": true};
    }, "throw": function(e) {
    if( !(this instanceof Generator$0) )throw new TypeError('throw method called on incompatible ' + this);
    if( this && this["__throw__"] )return this["__throw__"](e);
    else throw e
    }, "toString": function() {
    return '[object Generator]'
    }};
    if( S_MARK$0 )S_MARK$0(Generator$0.prototype);
    Generator$0.prototype[S_STAG$0] = 'Generator';
    Generator$0.prototype[S_ITER$0] = function() {
    return this
    };
    if( S_MARK$0 )S_MARK$0(void 0);
    var $D$0;
    var $D$1;
    var $D$2;
    var $D$3;
    var $D$4;
    var $D$5;
    var x;
    var y;
    var done$0 = false;
    var init$0 = false;
    var init$1 = false;
    var state$0 = 1, next$0 = false;
    return new Generator$0(function next(throw_error$0, throw$0) {
    if( throw$0 === true ) {
    done$0 = true;
    }
    if( done$0 === false ) {
    while( true ) {
    next$0 = false;
    switch( state$0 ) {
    case 1:
    if( init$0 === false ) {
    $D$0 = GET_ITER$0(arr1);
    $D$2 = $D$0 === 0;
    $D$1 = ($D$2 ? arr1.length : void 0);
    init$0 = true;
    }
    next$0 = $D$2 ? ($D$0 < $D$1) : !($D$1 = $D$0["next"]())["done"];
    if( next$0 ) {
    x = ($D$2 ? arr1[$D$0++] : $D$1["value"]);
    state$0 = 2;
    }
    else {
    break;
    }
    case 2:
    if( init$1 === false ) {
    y = void 0;
    $D$3 = GET_ITER$0(arr2);
    $D$5 = $D$3 === 0;
    $D$4 = ($D$5 ? arr2.length : void 0);
    init$1 = true;
    }
    next$0 = $D$5 ? ($D$3 < $D$4) : !($D$4 = $D$3["next"]())["done"];
    if( next$0 ) {
    y = ($D$5 ? arr2[$D$3++] : $D$4["value"]).a;
    }
    else {
    state$0 = 1;
    init$1 = false;
    ;
    $D$3 = $D$4 = $D$5 = void 0;
    y = void 0;
    continue;
    }
    ;
    }
    if( next$0 ) {
    ;
    if( x != 2 ) {
    return {"value": x + y, "done": false};
    }
    else {
    x = void 0;
    done$0 = true;
    break
    continue;
    }
    }
    }
    if( done$0 === true ) {
    $D$0 = $D$1 = $D$2 = void 0;
    $D$3 = $D$4 = $D$5 = void 0;
    if( typeof this === 'object' && this && this["__next__"] === next ) {
    delete this["__next__"];
    delete this["__throw__"];
    else {
    x = void 0;
    done$0 = true;
    break
    }
    next = void 0;
    }
    if( throw$0 === true ) {
    throw throw_error$0;
    }
    if( done$0 === true ) {
    ;
    $D$0 = $D$1 = $D$2 = void 0;
    ;
    $D$3 = $D$4 = $D$5 = void 0;
    y = void 0;
    if( this && this["__next__"] === next ) {
    delete this["__next__"];
    delete this["__throw__"];
    }
    return {"value": void 0, "done": true};
    }, function(err) {
    throw_error$0 = err;
    throw$0 = true;
    return this["next"]();
    })
    })();
    ;
    }
    ;
    if( throw$0 === true ) {
    throw throw_error$0;
    }
    ;
    return {"value": void 0, "done": true};
    }, function(err) {
    if( this && this["__next__"] ) {
    return this["__next__"](err, true);
    }
    else {
    throw err
    }
    })
    })()

    $D$6 = GET_ITER$0(gen);
    $D$8 = $D$6 === 0;
    $D$7 = ($D$8 ? gen.length : void 0);
    for( var a; $D$8 ? ($D$6 < $D$7) : !($D$7 = $D$6["next"]())["done"]; ) {
    a = ($D$8 ? gen[$D$6++] : $D$7["value"]);
    console.log(a)
    }
    $D$6 = GET_ITER$0(gen);
    $D$8 = $D$6 === 0;
    $D$7 = ($D$8 ? gen.length : void 0);
    for( var a; $D$8 ? ($D$6 < $D$7) : !($D$7 = $D$6["next"]())["done"]; ) {
    a = ($D$8 ? gen[$D$6++] : $D$7["value"]);
    console.log(a)
    }

    ;
    $D$6 = $D$7 = $D$8 = void 0;
    10 changes: 5 additions & 5 deletions gen.es5.js
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    var S_ITER$0 = typeof Symbol!=='undefined'&&Symbol.iterator||'@@iterator';var S_MARK$0 = typeof Symbol!=='undefined'&&Symbol&&Symbol["__setObjectSetter__"];function GET_ITER$0(v){if(v){if(Array.isArray(v))return 0;var f;if(S_MARK$0)S_MARK$0(v);if(typeof v==='object'&&typeof (f=v[S_ITER$0])==='function'){if(S_MARK$0)S_MARK$0(void 0);return f.call(v);}if(S_MARK$0)S_MARK$0(void 0);if((v+'')==='[object Generator]')return v;}throw new Error(v+' is not iterable')};var $D$6;var $D$7;var $D$8;
    {var arr1 = [1, 2, 3], arr2 = [{a:'a'}, {a:'b'}, {a:'c'}];
    var gen = (function(){var Generator$0 = function Generator(){if(!(this instanceof Generator))throw new TypeError();this["__next__"]=arguments[0];this["__throw__"]=arguments[1];};Generator$0.prototype={constructor:Generator$0,"next":function(val){if(this&&this["__next__"]){try {return this["__next__"](val);}catch(e){if(this["__throw__"])return this["__throw__"](e);else throw e;}}else return {"value":void 0,"done":true};},"throw":function(e){if(this["__throw__"])return this["__throw__"](e);else throw e},"toString":function(){return '[object Generator]'}};if(S_MARK$0)S_MARK$0(Generator$0.prototype);Generator$0.prototype[typeof Symbol!=='undefined'&&Symbol&&Symbol["toStringTag"]||'@@toStringTag']='Generator';Generator$0.prototype[typeof Symbol!=='undefined'&&Symbol&&Symbol["iterator"]||'@@iterator']=function(){return this};if(S_MARK$0)S_MARK$0(void 0);var $D$0;var $D$1;var $D$2;var $D$3;var $D$4;var $D$5;var x;var done$0=false,throw$0=false,throw_error$0;var init$0=false;var init$1=false;var state$0=1,next$0=false;return new Generator$0(function next(){if(throw$0===true){done$0=true;}if(done$0===false){while(true){next$0=false;switch(state$0){case 1:if(init$0===false){$D$0 = GET_ITER$0(arr1);$D$2 = $D$0 === 0;$D$1 = ($D$2 ? arr1.length : void 0);init$0=true;}next$0=$D$2 ? ($D$0 < $D$1) : !($D$1 = $D$0["next"]())["done"];if(next$0){x = ($D$2 ? arr1[$D$0++] : $D$1["value"]);state$0=2;}else {break;}case 2:if(init$1===false){var y=void 0;$D$3 = GET_ITER$0(arr2);$D$5 = $D$3 === 0;$D$4 = ($D$5 ? arr2.length : void 0);init$1=true;}next$0=$D$5 ? ($D$3 < $D$4) : !($D$4 = $D$3["next"]())["done"];if(next$0){;y = ($D$5 ? arr2[$D$3++] : $D$4["value"]).a;}else{state$0=1;init$1=false;continue;};}if(next$0){;if(x != 2){return {"value":x + y,"done":false};}else {continue;}}else{x=void 0;done$0=true;break}}}if(done$0===true){;$D$0 = $D$1 = $D$2 = void 0;;$D$3 = $D$4 = $D$5 = void 0;if(typeof this==='object'&&this&&this["__next__"]===next){delete this["__next__"];delete this["__throw__"];};next=void 0;};if(throw$0===true){throw throw_error$0;};return {"value":void 0,"done":true};},function(err){throw_error$0=err;throw$0=true;return this["next"]();})})()

    var S_ITER$0 = typeof Symbol!=='undefined'&&Symbol&&Symbol.iterator||'@@iterator';var S_MARK$0 = typeof Symbol!=='undefined'&&Symbol&&Symbol["__setObjectSetter__"];function GET_ITER$0(v){if(v){if(Array.isArray(v))return 0;var f;if(S_MARK$0)S_MARK$0(v);if(typeof v==='object'&&typeof (f=v[S_ITER$0])==='function'){if(S_MARK$0)S_MARK$0(void 0);return f.call(v);}if(S_MARK$0)S_MARK$0(void 0);if((v+'')==='[object Generator]')return v;}throw new Error(v+' is not iterable')};var $D$6;var $D$7;var $D$8;
    var arr1 = [1, 2, 3], arr2 = [{a:'a'}, {a:'b'}, {a:'c'}];
    var gen = (function(){var S_STAG$0 = typeof Symbol!=='undefined'&&Symbol&&Symbol["toStringTag"]||'@@toStringTag';var Generator$0 = function Generator(){if(!(this instanceof Generator$0))throw new TypeError('incompatible'+this);this["__next__"]=arguments[0];this["__throw__"]=arguments[1];};Generator$0.prototype={constructor:Generator$0,"next":function(val){if(!(this instanceof Generator$0))throw new TypeError('next method called on incompatible '+this);if(this["__next__"]){try {return this["__next__"](val);}catch(e){if(this["__throw__"])return this["__throw__"](e);else throw e;}}else return {"value":void 0,"done":true};},"throw":function(e){if(!(this instanceof Generator$0))throw new TypeError('throw method called on incompatible '+this);if(this&&this["__throw__"])return this["__throw__"](e);else throw e},"toString":function(){return '[object Generator]'}};if(S_MARK$0)S_MARK$0(Generator$0.prototype);Generator$0.prototype[S_STAG$0]='Generator';Generator$0.prototype[S_ITER$0]=function(){return this};if(S_MARK$0)S_MARK$0(void 0);var $D$0;var $D$1;var $D$2;var $D$3;var $D$4;var $D$5;var x;var y;var done$0=false;var init$0=false;var init$1=false;var state$0=1,next$0=false;return new Generator$0(function next(throw_error$0,throw$0){if(throw$0===true){done$0=true;}if(done$0===false){while(true){next$0=false;switch(state$0){case 1:if(init$0===false){$D$0 = GET_ITER$0(arr1);$D$2 = $D$0 === 0;$D$1 = ($D$2 ? arr1.length : void 0);init$0=true;}next$0=$D$2 ? ($D$0 < $D$1) : !($D$1 = $D$0["next"]())["done"];if(next$0){x = ($D$2 ? arr1[$D$0++] : $D$1["value"]);state$0=2;}else {break;}case 2:if(init$1===false){y=void 0;$D$3 = GET_ITER$0(arr2);$D$5 = $D$3 === 0;$D$4 = ($D$5 ? arr2.length : void 0);init$1=true;}next$0=$D$5 ? ($D$3 < $D$4) : !($D$4 = $D$3["next"]())["done"];if(next$0){y = ($D$5 ? arr2[$D$3++] : $D$4["value"]).a;}else{state$0=1;init$1=false;;$D$3 = $D$4 = $D$5 = void 0;y=void 0;continue;};}if(next$0){;if(x != 2){return {"value":x + y,"done":false};}else {continue;}}else{x=void 0;done$0=true;break}}}if(done$0===true){;$D$0 = $D$1 = $D$2 = void 0;;$D$3 = $D$4 = $D$5 = void 0;y=void 0;if(this&&this["__next__"]===next){delete this["__next__"];delete this["__throw__"];};};if(throw$0===true){throw throw_error$0;};return {"value":void 0,"done":true};},function(err){if(this&&this["__next__"]){return this["__next__"](err,true);}else {throw err}})})()
    $D$6 = GET_ITER$0(gen);$D$8 = $D$6 === 0;$D$7 = ($D$8 ? gen.length : void 0);for( var a ;$D$8 ? ($D$6 < $D$7) : !($D$7 = $D$6["next"]())["done"];){a = ($D$8 ? gen[$D$6++] : $D$7["value"]);
    console.log(a)
    }};$D$6 = $D$7 = $D$8 = void 0;
    };$D$6 = $D$7 = $D$8 = void 0;
    1 change: 1 addition & 0 deletions gen.es6.js
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,4 @@

    var arr1 = [1, 2, 3], arr2 = [{a:'a'}, {a:'b'}, {a:'c'}];
    var gen = ( x + y for (x of arr1) for ({a: y} of arr2) if ( x != 2 ) )

  2. termi revised this gist Aug 15, 2014. 1 changed file with 0 additions and 1 deletion.
    1 change: 0 additions & 1 deletion gen.es6.js
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,3 @@

    var arr1 = [1, 2, 3], arr2 = [{a:'a'}, {a:'b'}, {a:'c'}];
    var gen = ( x + y for (x of arr1) for ({a: y} of arr2) if ( x != 2 ) )

  3. termi created this gist Aug 15, 2014.
    150 changes: 150 additions & 0 deletions gen.es5.bt.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,150 @@
    var S_ITER$0 = typeof Symbol !== 'undefined' && Symbol.iterator || '@@iterator';
    var S_MARK$0 = typeof Symbol !== 'undefined' && Symbol && Symbol["__setObjectSetter__"];
    function GET_ITER$0(v) {
    if( v ) {
    if( Array.isArray(v) )return 0;
    var f;
    if( S_MARK$0 )S_MARK$0(v);
    if( typeof v === 'object' && typeof (f = v[S_ITER$0]) === 'function' ) {
    if( S_MARK$0 )S_MARK$0(void 0);
    return f.call(v);
    }
    if( S_MARK$0 )S_MARK$0(void 0);
    if( (v + '') === '[object Generator]' )return v;
    }
    throw new Error(v + ' is not iterable')
    }
    var $D$6;
    var $D$7;
    var $D$8;
    {
    var arr1 = [1, 2, 3], arr2 = [
    {a: 'a'},
    {a: 'b'},
    {a: 'c'}
    ];
    var gen = (function() {
    var Generator$0 = function Generator() {
    if( !(this instanceof Generator) )throw new TypeError();
    this["__next__"] = arguments[0];
    this["__throw__"] = arguments[1];
    };
    Generator$0.prototype = {constructor: Generator$0, "next": function(val) {
    if( this && this["__next__"] ) {
    try {
    return this["__next__"](val);
    } catch( e ) {
    if( this["__throw__"] )return this["__throw__"](e);
    else throw e;
    }
    }
    else return {"value": void 0, "done": true};
    }, "throw": function(e) {
    if( this["__throw__"] )return this["__throw__"](e);
    else throw e
    }, "toString": function() {
    return '[object Generator]'
    }};
    if( S_MARK$0 )S_MARK$0(Generator$0.prototype);
    Generator$0.prototype[typeof Symbol !== 'undefined' && Symbol && Symbol["toStringTag"] || '@@toStringTag'] = 'Generator';
    Generator$0.prototype[typeof Symbol !== 'undefined' && Symbol && Symbol["iterator"] || '@@iterator'] = function() {
    return this
    };
    if( S_MARK$0 )S_MARK$0(void 0);
    var $D$0;
    var $D$1;
    var $D$2;
    var $D$3;
    var $D$4;
    var $D$5;
    var x;
    var done$0 = false, throw$0 = false, throw_error$0;
    var init$0 = false;
    var init$1 = false;
    var state$0 = 1, next$0 = false;
    return new Generator$0(function next() {
    if( throw$0 === true ) {
    done$0 = true;
    }
    if( done$0 === false ) {
    while( true ) {
    next$0 = false;
    switch( state$0 ) {
    case 1:
    if( init$0 === false ) {
    $D$0 = GET_ITER$0(arr1);
    $D$2 = $D$0 === 0;
    $D$1 = ($D$2 ? arr1.length : void 0);
    init$0 = true;
    }
    next$0 = $D$2 ? ($D$0 < $D$1) : !($D$1 = $D$0["next"]())["done"];
    if( next$0 ) {
    x = ($D$2 ? arr1[$D$0++] : $D$1["value"]);
    state$0 = 2;
    }
    else {
    break;
    }
    case 2:
    if( init$1 === false ) {
    var y = void 0;
    $D$3 = GET_ITER$0(arr2);
    $D$5 = $D$3 === 0;
    $D$4 = ($D$5 ? arr2.length : void 0);
    init$1 = true;
    }
    next$0 = $D$5 ? ($D$3 < $D$4) : !($D$4 = $D$3["next"]())["done"];
    if( next$0 ) {
    y = ($D$5 ? arr2[$D$3++] : $D$4["value"]).a;
    }
    else {
    state$0 = 1;
    init$1 = false;
    continue;
    }
    }
    if( next$0 ) {
    if( x != 2 ) {
    return {"value": x + y, "done": false};
    }
    else {
    continue;
    }
    }
    else {
    x = void 0;
    done$0 = true;
    break
    }
    }
    }
    if( done$0 === true ) {
    $D$0 = $D$1 = $D$2 = void 0;
    $D$3 = $D$4 = $D$5 = void 0;
    if( typeof this === 'object' && this && this["__next__"] === next ) {
    delete this["__next__"];
    delete this["__throw__"];
    }
    next = void 0;
    }
    if( throw$0 === true ) {
    throw throw_error$0;
    }
    return {"value": void 0, "done": true};
    }, function(err) {
    throw_error$0 = err;
    throw$0 = true;
    return this["next"]();
    })
    })();

    $D$6 = GET_ITER$0(gen);
    $D$8 = $D$6 === 0;
    $D$7 = ($D$8 ? gen.length : void 0);
    for( var a; $D$8 ? ($D$6 < $D$7) : !($D$7 = $D$6["next"]())["done"]; ) {
    a = ($D$8 ? gen[$D$6++] : $D$7["value"]);
    console.log(a)
    }
    }

    $D$6 = $D$7 = $D$8 = void 0;
    7 changes: 7 additions & 0 deletions gen.es5.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,7 @@
    var S_ITER$0 = typeof Symbol!=='undefined'&&Symbol.iterator||'@@iterator';var S_MARK$0 = typeof Symbol!=='undefined'&&Symbol&&Symbol["__setObjectSetter__"];function GET_ITER$0(v){if(v){if(Array.isArray(v))return 0;var f;if(S_MARK$0)S_MARK$0(v);if(typeof v==='object'&&typeof (f=v[S_ITER$0])==='function'){if(S_MARK$0)S_MARK$0(void 0);return f.call(v);}if(S_MARK$0)S_MARK$0(void 0);if((v+'')==='[object Generator]')return v;}throw new Error(v+' is not iterable')};var $D$6;var $D$7;var $D$8;
    {var arr1 = [1, 2, 3], arr2 = [{a:'a'}, {a:'b'}, {a:'c'}];
    var gen = (function(){var Generator$0 = function Generator(){if(!(this instanceof Generator))throw new TypeError();this["__next__"]=arguments[0];this["__throw__"]=arguments[1];};Generator$0.prototype={constructor:Generator$0,"next":function(val){if(this&&this["__next__"]){try {return this["__next__"](val);}catch(e){if(this["__throw__"])return this["__throw__"](e);else throw e;}}else return {"value":void 0,"done":true};},"throw":function(e){if(this["__throw__"])return this["__throw__"](e);else throw e},"toString":function(){return '[object Generator]'}};if(S_MARK$0)S_MARK$0(Generator$0.prototype);Generator$0.prototype[typeof Symbol!=='undefined'&&Symbol&&Symbol["toStringTag"]||'@@toStringTag']='Generator';Generator$0.prototype[typeof Symbol!=='undefined'&&Symbol&&Symbol["iterator"]||'@@iterator']=function(){return this};if(S_MARK$0)S_MARK$0(void 0);var $D$0;var $D$1;var $D$2;var $D$3;var $D$4;var $D$5;var x;var done$0=false,throw$0=false,throw_error$0;var init$0=false;var init$1=false;var state$0=1,next$0=false;return new Generator$0(function next(){if(throw$0===true){done$0=true;}if(done$0===false){while(true){next$0=false;switch(state$0){case 1:if(init$0===false){$D$0 = GET_ITER$0(arr1);$D$2 = $D$0 === 0;$D$1 = ($D$2 ? arr1.length : void 0);init$0=true;}next$0=$D$2 ? ($D$0 < $D$1) : !($D$1 = $D$0["next"]())["done"];if(next$0){x = ($D$2 ? arr1[$D$0++] : $D$1["value"]);state$0=2;}else {break;}case 2:if(init$1===false){var y=void 0;$D$3 = GET_ITER$0(arr2);$D$5 = $D$3 === 0;$D$4 = ($D$5 ? arr2.length : void 0);init$1=true;}next$0=$D$5 ? ($D$3 < $D$4) : !($D$4 = $D$3["next"]())["done"];if(next$0){;y = ($D$5 ? arr2[$D$3++] : $D$4["value"]).a;}else{state$0=1;init$1=false;continue;};}if(next$0){;if(x != 2){return {"value":x + y,"done":false};}else {continue;}}else{x=void 0;done$0=true;break}}}if(done$0===true){;$D$0 = $D$1 = $D$2 = void 0;;$D$3 = $D$4 = $D$5 = void 0;if(typeof this==='object'&&this&&this["__next__"]===next){delete this["__next__"];delete this["__throw__"];};next=void 0;};if(throw$0===true){throw throw_error$0;};return {"value":void 0,"done":true};},function(err){throw_error$0=err;throw$0=true;return this["next"]();})})()

    $D$6 = GET_ITER$0(gen);$D$8 = $D$6 === 0;$D$7 = ($D$8 ? gen.length : void 0);for( var a ;$D$8 ? ($D$6 < $D$7) : !($D$7 = $D$6["next"]())["done"];){a = ($D$8 ? gen[$D$6++] : $D$7["value"]);
    console.log(a)
    }};$D$6 = $D$7 = $D$8 = void 0;
    7 changes: 7 additions & 0 deletions gen.es6.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,7 @@

    var arr1 = [1, 2, 3], arr2 = [{a:'a'}, {a:'b'}, {a:'c'}];
    var gen = ( x + y for (x of arr1) for ({a: y} of arr2) if ( x != 2 ) )

    for( let a of gen ) {
    console.log(a)
    }