function convertToMixed(path, params) {
  let prev = path[0];

  path = path.filter(function (item, index) {
    if (index == 0) {
      return true;
    }
    if (item.command === 'Z' || item.command === 'z') {
      prev = item;
      return true;
    }

    const command = item.command;
    const data = item.args;
    const adata = data.slice();
    const rdata = data.slice();

    if (
      command === 'm' ||
      command === 'l' ||
      command === 't' ||
      command === 'q' ||
      command === 's' ||
      command === 'c'
    ) {
      for (let i = adata.length; i--; ) {
        // @ts-expect-error
        adata[i] += item.base[i % 2];
      }
    } else if (command == 'h') {
      // @ts-expect-error
      adata[0] += item.base[0];
    } else if (command == 'v') {
      // @ts-expect-error
      adata[0] += item.base[1];
    } else if (command == 'a') {
      // @ts-expect-error
      adata[5] += item.base[0];
      // @ts-expect-error
      adata[6] += item.base[1];
    }

    roundData(adata);
    roundData(rdata);

    const absoluteDataStr = cleanupOutData(adata, params);
    const relativeDataStr = cleanupOutData(rdata, params);

    // Convert to absolute coordinates if it's shorter or forceAbsolutePath is true.
    // v-20 -> V0
    // Don't convert if it fits following previous command.
    // l20 30-10-50 instead of l20 30L20 30
    if (
      params.forceAbsolutePath ||
      (absoluteDataStr.length < relativeDataStr.length &&
        !(
          params.negativeExtraSpace &&
          command == prev.command &&
          prev.command.charCodeAt(0) > 96 &&
          absoluteDataStr.length == relativeDataStr.length - 1 &&
          (data[0] < 0 ||
            (Math.floor(data[0]) === 0 &&
              !Number.isInteger(data[0]) &&
              prev.args[prev.args.length - 1] % 1))
        ))
    ) {
      // @ts-expect-error
      item.command = command.toUpperCase();
      item.args = adata;
    }

    prev = item;
    return true;
  });

  return path;
}
Writes data in shortest form using absolute or relative coordinates.

@param {import('../lib/types.js').PathDataItem[]} path
@param {InternalParams} params
@returns {import('../lib/types.js').PathDataItem[]}