buildMatchConfig = methodGuardPayload => {
  const {
    argGuards,
    optionalArgGuards = [],
    restArgGuard,
  } = methodGuardPayload;

  const matchableArgGuards = [...argGuards, ...optionalArgGuards];

  const redactedIndices = [];
  for (let i = 0; i < matchableArgGuards.length; i += 1) {
    if (isRawGuard(matchableArgGuards[i])) {
      matchableArgGuards[i] = REDACTED_RAW_ARG;
      redactedIndices.push(i);
    }
  }

  // Pass through raw rest arguments without matching.
  let matchableRestArgGuard = restArgGuard;
  if (isRawGuard(matchableRestArgGuard)) {
    matchableRestArgGuard = M.arrayOf(REDACTED_RAW_ARG);
  }
  const matchableMethodGuardPayload = harden({
    ...methodGuardPayload,
    argGuards: matchableArgGuards.slice(0, argGuards.length),
    optionalArgGuards: matchableArgGuards.slice(argGuards.length),
    restArgGuard: matchableRestArgGuard,
  });

  const paramsPattern = M.splitArray(
    matchableMethodGuardPayload.argGuards,
    matchableMethodGuardPayload.optionalArgGuards,
    matchableMethodGuardPayload.restArgGuard,
  );

  return harden({
    declaredLen: matchableArgGuards.length,
    hasRestArgGuard: restArgGuard !== undefined,
    restArgGuardIsRaw: restArgGuard !== matchableRestArgGuard,
    paramsPattern,
    redactedIndices,
    matchableMethodGuardPayload,
  });
}
Convert a method guard to a match config for more efficient per-call
execution.  This is a one-time conversion, so it's OK to be slow.

Most of the work is done to detect `M.raw()` so that we build a match pattern
and metadata instead of doing this in the hot path.
@param {MethodGuardPayload} methodGuardPayload
@returns {MatchConfig}