message: perf: optimise error message generation for targets
diff: @@ -216,7 +216,7 @@ function _generateFieldError(
  _field_: field.name,
  _value_: value,
  _rule_: ruleName,
  - ..._getTargetName(field, ruleSchema, ruleName)
  + ..._getTargetNames(field, ruleSchema, ruleName)
  };
  if (
  @@ -242,28 +242,31 @@ function _generateFieldError(
  };
  }
  -function _getTargetName(
  +function _getTargetNames(
  field: FieldContext,
  ruleSchema: ValidationRuleSchema,
  ruleName: string
  ): Record<string, string> {
  if (ruleSchema.params) {
  - const hasMultiple = ruleSchema.params.filter(param => (param as RuleParamConfig).isTarget).length > 1;
  + const numTargets = ruleSchema.params.filter(param => (param as RuleParamConfig).isTarget).length;
  + if (numTargets > 0) {
  const names: Record<string, string> = {};
  for (let index = 0; index < ruleSchema.params.length; index++) {
  const param: RuleParamConfig = ruleSchema.params[index] as RuleParamConfig;
  if (param.isTarget) {
  const key = field.rules[ruleName][index];
  const name = field.names[key] || key;
  - if (hasMultiple) {
  - names[`_${param.name}Target_`] = name;
  - } else {
  + if (numTargets === 1) {
  names._target_ = name;
  + break;
  + } else {
  + names[`_${param.name}Target_`] = name;
  }
  }
  }
  return names;
  }
  + }
  return {};
  }
  