code: function _getSubstring (str, index) {
    if (!isIndex(index)) {
      // TODO: better error message
      throw new TypeError('Index expected')
    }
    if (index.size().length !== 1) {
      throw new DimensionError(index.size().length, 1)
    }
  
    // validate whether the range is out of range
    const strLen = str.length
    validateIndex(index.min()[0], strLen)
    validateIndex(index.max()[0], strLen)
  
    const range = index.dimension(0)
  
    let substr = ''
    range.forEach(function (v) {
      substr += str.charAt(v)
    })
  
    return substr
  }
docs: Retrieve a subset of a string
  @param {string} str            string from which to get a substring
  @param {Index} index           An index containing ranges for each dimension
  @returns {string} substring
  @private