index.js
//parameters, exceptions to be thrown.
parameters, exceptions to be thrown.
parameters exceptions to be thrown .
function normalizeProcess( userProcess, executer ){
  let normalized =
    wrapUserProcess(
      userProcess,
      function( userProcess ){
        return function(){
          try{
            if( executer instanceof calledbackExecuter ) {
              return userProcess(
                arguments[0],
                arguments[1],
                arguments[2],
                arguments[3] 
              );
            } else if (executer instanceof outExecuter ){
              return userProcess(
                arguments[1],
                arguments[2] 
              );
            } else {
              return userProcess(
                arguments[0],
                arguments[1],
                arguments[2] 
              );
            }
          }catch(err){
            raiseError(
              executer.listenerCount('error') > 0 ?
              executer :
              defaultEmitter ,
              'User process error',
              err
            );
          }
        };
      }
    );
  return normalized;
}
function normalizeProcess ( userProcess , executer ) { let normalized = wrapUserProcess ( userProcess , function ( userProcess ) { return function ( ) { try { if ( executer instanceof calledbackExecuter ) { return userProcess ( arguments [ 0 ] , arguments [ 1 ] , arguments [ 2 ] , arguments [ 3 ] ) ; } else if ( executer instanceof outExecuter ) { return userProcess ( arguments [ 1 ] , arguments [ 2 ] ) ; } else { return userProcess ( arguments [ 0 ] , arguments [ 1 ] , arguments [ 2 ] ) ; } } catch ( err ) { raiseError ( executer . listenerCount ( 'error' ) > 0 ? executer : defaultEmitter , 'User process error' , err ) ; } } ; } ) ; return normalized ; }
parameters, exceptions to be thrown.
parameters exceptions to be thrown .
// json, filePath, callbackFunction, executer //json parameter of out does not exist // filePath, executer // json, filePath, executer //walkaround for unclear this/caller problem in javascript. //I just wanted to use something like "this".