@eyecone/cb2prom
v1.0.2
Published
Wraps node-style callbacks to promise, with ability to use a callback instead.
Readme
Node-style callback function to Promise
Install:
npm install @eyecone/util-cb2prom --save
Basic usage:
cb2prom(context, method, callback, ...args)
const cb2prom = require('@eyecone/cb2prom');
class WrapClass {
constructor() {
this.wrappedObject = new WrappedObject();
}
wrappedMethod(a, b, c, d, callback) {
return cb2prom(this.wrappedObject, this.wrappedObject.someMethod, callback, a, b, c, d);
}
}