Last active
December 2, 2016 01:59
-
-
Save jooyunghan/99afa33e2aa69e52cd74ee2569be2cee to your computer and use it in GitHub Desktop.
Babel-transpiled generator(fibo)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
var _marked = [fibo].map(regeneratorRuntime.mark); | |
function fibo() { | |
var a, b; | |
return regeneratorRuntime.wrap(function fibo$(_context) { | |
while (1) { | |
switch (_context.prev = _context.next) { | |
case 0: | |
a = 0, b = 1; | |
case 1: | |
if (!true) { | |
_context.next = 8; | |
break; | |
} | |
_context.next = 4; | |
return a; | |
case 4: | |
b = a + b; | |
a = b - a; | |
_context.next = 1; | |
break; | |
case 8: | |
case "end": | |
return _context.stop(); | |
} | |
} | |
}, _marked[0], this); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function* fibo() { | |
let a=0, b=1 | |
while (true) { | |
yield a | |
b = a + b | |
a = b - a | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment