This question already has answers here: What is “function*” in JavaScript? (3 answers) Closed 6 years ago .

I saw something strange in Koa. It has some new function names (from https://github.com/koajs/koa/blob/master/examples/co.js#L10):

app.use(function(){ return function *(){ var paths = yield fs.readdir('docs'); var files = yield paths.map(function(path){ return fs.readFile('docs/' + path, 'utf8'); }); this.type = 'markdown'; this.body = files.join(''); } });