corunner

0.0.1 • Public • Published

CoRunner

corunner is a lightweight (<50 LOC) coroutine library, for use with javascript generators

Installation

npm install --save corunner

Usage

    let run = require('corunner');
    
    let func = run(function *(firstname, secondname) {
   
        // yield Promises for synchronous looking, async code
        let email = yield Promise.resolve('name@email.com');
 
        // the returned value will be resolve in the returned promise
        return `${firstname} ${secondname} ${email}`;
    });
    
    // func is now a function that returns a Promise
    func('Allan', 'Ross').then(description => {
        console.log(description === 'Allan Ross name@email.com')
    }).catch(console.error);

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.0.1
    0
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.0.1
    0
  • 0.0.0
    0

Package Sidebar

Install

npm i corunner

Weekly Downloads

0

Version

0.0.1

License

MIT

Last publish

Collaborators

  • mofax