lib/index.js
/**
 * create and returns hystrix functions
 * @param  {Object} fn list of functions to generate commands for. fn can be of type Array of functions or Function
 * @param  {Object} service config service object
 * @return {Object} hystrix functions
 */
create and returns hystrix functions
@param  {Object} fn list of functions to generate commands for. fn can be of type Array of functions or Function
@param  {Object} service config service object
@return {Object} hystrix functions
create and returns hystrix functions @param { Object } fn list of functions to generate commands for . fn can be of type Array of functions or Function @param { Object } service config service object @return { Object } hystrix functions
function createHystrixCommands(fn, service, circuitBreakerImpl = DEFAULT_CIRCUIT_BREAKER) {
  const hystrixFunctions = {};
  const serviceFns = Object.keys(fn);
  if (typeof fn === 'function') {
    hystrixFunctions[fn.name] = createServiceCommand(fn, service, undefined, circuitBreakerImpl);
  } else if (Array.isArray(fn)) {
    fn.forEach((func) => {
      hystrixFunctions[func.name] = createServiceCommand(func, service, undefined, circuitBreakerImpl);
    });
  } else if (typeof fn === 'object') {
    serviceFns.forEach((func) => {
      hystrixFunctions[func] = createServiceCommand(fn[func], service, func, circuitBreakerImpl);
    });
  } else {
    throw 'Parameter is not a function!';
  }
  return createExecutableCommands(hystrixFunctions, circuitBreakerImpl);
}
function createHystrixCommands ( fn , service , circuitBreakerImpl = DEFAULT_CIRCUIT_BREAKER ) { const hystrixFunctions = { } ; const serviceFns = Object . keys ( fn ) ; if ( typeof fn === 'function' ) { hystrixFunctions [ fn . name ] = createServiceCommand ( fn , service , undefined , circuitBreakerImpl ) ; } else if ( Array . isArray ( fn ) ) { fn . forEach ( ( func ) => { hystrixFunctions [ func . name ] = createServiceCommand ( func , service , undefined , circuitBreakerImpl ) ; } ) ; } else if ( typeof fn === 'object' ) { serviceFns . forEach ( ( func ) => { hystrixFunctions [ func ] = createServiceCommand ( fn [ func ] , service , func , circuitBreakerImpl ) ; } ) ; } else { throw 'Parameter is not a function!' ; } return createExecutableCommands ( hystrixFunctions , circuitBreakerImpl ) ; }
create and returns hystrix functions
 @param  {Object} fn list of functions to generate commands for.
create and returns hystrix functions @param { Object } fn list of functions to generate commands for .