lib/Compat.js
function utilCallbackAfterPromise(self, func, args, cb) {
	args = Array.prototype.slice.apply(args);
	let lastarg = args.pop();
	if(!cb) cb = lastarg;
	func.apply(self, args).then(res => {
		try {
			cb(null, res);
		} catch(e) {
			process.nextTick(() => { throw e });
		}
	}).catch((err) => {
		try {
			cb(err);
		} catch(e) {
			process.nextTick(() => { throw e });
		}
	});
}
function utilCallbackAfterPromise(self, func, args, cb) {
	args = Array.prototype.slice.apply(args);
	let lastarg = args.pop();
	if(!cb) cb = lastarg;
	func.apply(self, args).then(res => {
		try {
			cb(null, res);
		} catch(e) {
			process.nextTick(() => { throw e });
		}
	}).catch((err) => {
		try {
			cb(err);
		} catch(e) {
			process.nextTick(() => { throw e });
		}
	});
}
function utilCallbackAfterPromise ( self , func , args , cb ) { args = Array . prototype . slice . apply ( args ) ; let lastarg = args . pop ( ) ; if ( ! cb ) cb = lastarg ; func . apply ( self , args ) . then ( res => { try { cb ( null , res ) ; } catch ( e ) { process . nextTick ( ( ) => { throw e } ) ; } } ) . catch ( ( err ) => { try { cb ( err ) ; } catch ( e ) { process . nextTick ( ( ) => { throw e } ) ; } } ) ; }
Strips the callback argument, and calls the function without, then invokes the callback when the promise returns
Strips the callback argument and calls the function without then invokes the callback when the promise returns