lib/utils.js
function promiseWrapper(options, originalCallback, handler) {
  if (typeof originalCallback === 'function') {
    // Callback-based invocation
    handler.call(this, originalCallback);
    return undefined;
  }
  const factory = options.promiseFactory || defaultPromiseFactory;
  const self = this;
  return factory(function handlerWrapper(callback) {
    handler.call(self, callback);
  });
}
function promiseWrapper(options, originalCallback, handler) {
  if (typeof originalCallback === 'function') {
    // Callback-based invocation
    handler.call(this, originalCallback);
    return undefined;
  }
  const factory = options.promiseFactory || defaultPromiseFactory;
  const self = this;
  return factory(function handlerWrapper(callback) {
    handler.call(self, callback);
  });
}
function promiseWrapper ( options , originalCallback , handler ) { if ( typeof originalCallback === 'function' ) { // Callback-based invocation handler . call ( this , originalCallback ) ; return undefined ; } const factory = options . promiseFactory || defaultPromiseFactory ; const self = this ; return factory ( function handlerWrapper ( callback ) { handler . call ( self , callback ) ; } ) ; }
Wraps the callback-based method. When no originalCallback is not defined, it returns a Promise.
@param {ClientOptions} options
@param {Function} originalCallback
@param {Function} handler
@returns {Promise|undefined}
Wraps the callback - based method . When no originalCallback is not defined it returns a Promise .