auto-yield-delegate

0.9.2 • Public • Published

auto-yield

Git tag NPM version

Automatically add yield to generator calls.

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, userFnNameOrGetter)

  • 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
  • userFnNameOrGetter - string of call function wrapper or function determining call function wrapper string, function accepts one argument that is the name of the function node that is being called (path.node.callee.name).

Returns: transformed code

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i auto-yield-delegate

Weekly Downloads

1

Version

0.9.2

License

MIT

Unpacked Size

10.5 kB

Total Files

7

Last publish

Collaborators

  • danleavitt0
  • julescubtree