func-to-async
v1.1.0
Published
Utility to create an async function from a sync one
Downloads
6
Readme
func-to-async
Utility to convert a sync function to async.
Install
$ npm install func-to-async --save
Usage
var toAsync = require('func-to-async');
var asyncFunc = toAsync(syncFunc);
asyncFunc(function(err) {
if(err) {
return console.error(err);
}
});
view tests for more examples.
API
func-to-async(fn#Function, [ctx#Object])
fn
Type: Function
The Sync function to convert to async
ctx
Type: Object
optional
context to bind the function to.
License
MIT