function extractArgumentsFromRequest(command, request) {
  let args = [];

  // Dealing with exceptions
  if (command === "set") {
    return extractArgumentsFromRequestForSet(request);
  }
  if (command === "sort") {
    return extractArgumentsFromRequestForSort(request);
  }
  if (command === "zadd") {
    return extractArgumentsFromRequestForZAdd(request);
  }
  if (command === "zinterstore") {
    return extractArgumentsFromRequestForZInterstore(request);
  }
  if (command === "zunionstore") {
    return extractArgumentsFromRequestForZInterstore(request);
  }
  if (command === "mexecute") {
    return extractArgumentsFromRequestForMExecute(request);
  }

  if (!mapping[command]) {
    return [];
  }

  if (!request.input.body) {
    request.input.body = {};
  }

  Object.keys(mapping[command]).forEach((key) => {
    const data = mapping[command][key];
    const path = Array.isArray(data) ? data : data.path;
    const toMerge = !Array.isArray(data) && data.merge === true;
    const map = !Array.isArray(data) && data.map;
    const skip = !Array.isArray(data) && data.skip === true;

    let value = path.reduce(
      (previousValue, currentValue, currentIndex, array) => {
        if (
          previousValue[array[currentIndex]] !== undefined &&
          previousValue[array[currentIndex]] !== null
        ) {
          return previousValue[array[currentIndex]];
        }
        return undefined;
      },
      request.input,
    );

    if (value === undefined) {
      if (skip) {
        return;
      }
      throw kerror.get("missing_argument", key);
    }

    if (map) {
      value = data.map(value, request);
    }

    if (value !== undefined) {
      if (toMerge && Array.isArray(value)) {
        args = args.concat(value);
      } else {
        args.push(value);
      }
    }
  });

  return args;
}
@param {string} command
@param {Request} request
@returns {*}