function spliceWith(data, startIndex, count, toInject) {
        var valueFactory = function valueFactory() {
          var result;

          if (toInject === 'array') {
            result = [];
          } else if (toInject === 'object') {
            result = {};
          }

          return result;
        };

        var spliceArgs = (0, _array.arrayMap)(new Array(count), function () {
          return valueFactory();
        });
        spliceArgs.unshift(startIndex, 0);
        data.splice.apply(data, (0, _toConsumableArray2.default)(spliceArgs));
      }
Inserts or removes rows and columns.

@memberof Core#
@function alter
@private
@param {String} action Possible values: "insert_row", "insert_col", "remove_row", "remove_col".
@param {Number|Array} index Row or column visual index which from the alter action will be triggered.
                            Alter actions such as "remove_row" and "remove_col" support array indexes in the
                            format `[[index, amount], [index, amount]...]` this can be used to remove
                            non-consecutive columns or rows in one call.
@param {Number} [amount=1] Ammount rows or columns to remove.
@param {String} [source] Optional. Source of hook runner.
@param {Boolean} [keepEmptyRows] Optional. Flag for preventing deletion of empty rows.