text: import durationSecHelper from './durationSecHelper';
  import extractMinMaxInUnits from './extractMinMaxInUnits';
  
  export default (contracts, type) => {
      if (type.indexOf('SPREAD') > -1) {
          return [];
      }
  
      const tickContracts = contracts.filter(c => c.min_contract_duration.slice(-1) === 't');
      const tickDuration = tickContracts.length > 0 ? { min: 5, max: 10, unit: 't' } : undefined;
  
      const nonTickContracts = contracts.filter(c => c.min_contract_duration.slice(-1) !== 't');
      if (nonTickContracts.length === 0) {
          return [tickDuration];
      }
      const nonTickMinSec = nonTickContracts
          .map(c => durationSecHelper(c.min_contract_duration))
          .filter(d => !!d)
          .reduce((a, b) => Math.min(a, b));
  
      const nonTickMaxSec = nonTickContracts
          .map(c => durationSecHelper(c.max_contract_duration))
          .filter(d => !!d)
          .reduce((a, b) => Math.max(a, b));
  
      const nonTicksDuration = extractMinMaxInUnits(nonTickMinSec, nonTickMaxSec);
      if (tickDuration) {
          nonTicksDuration.unshift(tickDuration);
      }
  
      return nonTicksDuration;
  };
  