co-tchar

0.2.1 • Public • Published

co-tchar

co routines using generators, avite use try catch to get error froms promises rejected.

co-tchar(generator || interator) -> Promise

yieldable

support thenable, promises, generators and iterators.

Usage

const cotchar = require('co-tchar')
 
cotchar(function*(){
    const res = yield Promise.resolve(1)
    assert(res === 1)
    const {error} = yield Promise.reject(new Error('testing'))
    assert(error.message === 'testing')
    const {error: error2} = yield [1,Promise.resolve(), Promise.reject()]
    assert(error2)
})

Readme

Keywords

Package Sidebar

Install

npm i co-tchar

Weekly Downloads

1

Version

0.2.1

License

MIT

Unpacked Size

8.35 kB

Total Files

7

Last publish

Collaborators

  • cereceres