text: import { NotImplementedError } from '../extensions/index.js';
  
  /**
   * Implement class DepthCalculator with method calculateDepth
   * that calculates deoth of nested array
   * 
   * @example
   * 
   * const depthCalc = new DepthCalculator();
   * depthCalc.calculateDepth([1, 2, 3, 4, 5]) => 1
   * depthCalc.calculateDepth([1, 2, 3, [4, 5]]) => 2
   * depthCalc.calculateDepth([[[]]]) => 3
   *
   */
  export default class DepthCalculator {
    calculateDepth(arr) {
      let depth = 1;
  
  
      if (hasNestedArray(arr)) {
        let innerArray = arr.reduce((previous, current) => previous.concat(current), []);
        return depth + this.calculateDepth(innerArray);
      }
  
  
      function hasNestedArray(array) {
        if (Array.isArray(array)) {
          if (array.some(item => Array.isArray(item))) {
            return true;
          } else {
            return false;
          }
        }
      }
  
      return depth;
  
    }
  }
  