code: function flattenToRank(arr, n) {
    var rankDiff = getRank(arr) - n
    if (rankDiff < 0) {
      return arr
    };
    while (rankDiff--) {
      arr = _.flatten(arr)
    }
    return arr
  }
docs: Flatten an array to rank n. Basically flatten it for (getRank - n) times. If the original rank is lower, just return the array.
  @private
  @param  {Array} arr The array to flatten to rank n.
  @param  {integer} n   Target rank to flatten to.
  @return {Array}     The flattened (or not) array.
   /* istanbul ignore next