deasync-generator-promise
v0.1.1
Published
Make generator synchronous, promises synchronous
Downloads
4
Maintainers
Readme
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'))