var timeout = 0;
if (options.durations) {
timeout = calculateDurationInMS(options.durations.timeUnit,
                                                     options.durations.timeInterval);
} else if (options.timeUnit && options.timeInterval) {
  timeout = calculateDurationInMS(durations.timUnit, durations.timeInterval);
}

Also are you sure you don't want to let one value to be overriden?