Skip to content

Automatically add yields and generators, making asynchronous programming easier for beginners.

Notifications You must be signed in to change notification settings

joshrtay/auto-yield

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

auto-yield

Build status Git tag NPM version Code style

Automatically add yield to generator calls, making asynchronous programming easier for beginners.

Installation

$ npm install auto-yield

Usage

var autoYield = require('auto-yield')

var code = autoYield(`
function main () {
  move()
}

function * move () {
  yield 'moving'
}
`) =>

`function* main() {
yield move();
}

function* move() {
yield 'moving';
}`

API

autoYield(code, globalGens, secondOrderGens)

  • code - code to transform
  • globalGens - array of global names or object names that are generators or have generators
  • secondOrderGens - array of functions that return generators

Returns: transformed code

License

MIT

About

Automatically add yields and generators, making asynchronous programming easier for beginners.

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •