deasync-generator-promise
Make generator synchronous, promises synchronous
Last updated 10 months ago by martinsson .
ISC · Original npm · Tarball
$ cnpm install deasync-generator-promise 
SYNC missed versions from official npm registry.

Make generators and promises synchronous

Don't contaminate the caller with asynchronism.

Avoid verbose promise syntax using generators.

    let [aExists, bExists] = dasyncGenerator(function*() {
            yield copyAsync(src, dest)
            yield renameFileAsync(oldName, newName)
            return yield [fsExistAsync(fileA), fsExistAsync(fileB)]
        })

Uses the excellent library co, and deasync

Also works for promises

let helloWorld = dasyncPromise(() => Promise.resolve('hello world'))
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 2
Dependencies (2)
Dev Dependencies (1)
Dependents (0)
None

Copyright 2014 - 2017 © taobao.org |