src/node/deferred.js
function wrapModule(module, functions) {
  if (typeof module === 'string')
    module = require(module);

  if (!functions) {
    for (var k in module) {
      // HACK: wrap all functions with a fnSync variant.
      if (typeof module[k] === 'function' &&
          typeof module[k + 'Sync'] === 'function')
        module[k] = wrapFunction(module[k]);
    }
  } else {
    for (var i = 0, k; i < functions.length; i++) {
      var k = functions[i];
      module[k] = wrapFunction(module[k]);
    }
  }

  return module;
}
function wrapModule(module, functions) {
  if (typeof module === 'string')
    module = require(module);

  if (!functions) {
    for (var k in module) {
      // HACK: wrap all functions with a fnSync variant.
      if (typeof module[k] === 'function' &&
          typeof module[k + 'Sync'] === 'function')
        module[k] = wrapFunction(module[k]);
    }
  } else {
    for (var i = 0, k; i < functions.length; i++) {
      var k = functions[i];
      module[k] = wrapFunction(module[k]);
    }
  }

  return module;
}
function wrapModule ( module , functions ) { if ( typeof module === 'string' ) module = require ( module ) ; if ( ! functions ) { for ( var k in module ) { // HACK: wrap all functions with a fnSync variant. if ( typeof module [ k ] === 'function' && typeof module [ k + 'Sync' ] === 'function' ) module [ k ] = wrapFunction ( module [ k ] ) ; } } else { for ( var i = 0 , k ; i < functions . length ; i ++ ) { var k = functions [ i ] ; module [ k ] = wrapFunction ( module [ k ] ) ; } } return module ; }
Wrap async functions in a module to enable the use of await.
If no function name array is provided, every function with a fnSync
variant will be wrapped.

@param {string|Object} module The exports of the module or a string that
will be passed to require to get the module.
@param {Array.<string>} functions Function names to wrap.
@return {object} The module.
Wrap async functions in a module to enable the use of await . If no function name array is provided every function with a fnSync variant will be wrapped .