react-hook-form 7.44.0-rc.1 → 7.44.0-rc.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -44,12 +44,14 @@ function cloneObject(data) {
44
44
  else if (!(isWeb && (data instanceof Blob || data instanceof FileList)) &&
45
45
  (isArray || isObject(data))) {
46
46
  copy = isArray ? [] : {};
47
- if (!Array.isArray(data) && !isPlainObject(data)) {
47
+ if (!isArray && !isPlainObject(data)) {
48
48
  copy = data;
49
49
  }
50
50
  else {
51
51
  for (const key in data) {
52
- copy[key] = cloneObject(data[key]);
52
+ if (Object.hasOwn(data, key)) {
53
+ copy[key] = cloneObject(data[key]);
54
+ }
53
55
  }
54
56
  }
55
57
  }
@@ -876,7 +878,7 @@ var validateField = async (field, formValues, validateAllFieldCriteria, shouldUs
876
878
  }
877
879
  }
878
880
  }
879
- if (pattern && !isEmpty && isString(inputValue)) {
881
+ if (pattern && isString(inputValue)) {
880
882
  const { value: patternValue, message } = getValueAndMessage(pattern);
881
883
  if (isRegex(patternValue) && !inputValue.match(patternValue)) {
882
884
  error[name] = {
@@ -995,7 +997,7 @@ function baseGet(object, updatePath) {
995
997
  }
996
998
  function isEmptyArray(obj) {
997
999
  for (const key in obj) {
998
- if (!isUndefined(obj[key])) {
1000
+ if (Object.hasOwn(obj, key) && !isUndefined(obj[key])) {
999
1001
  return false;
1000
1002
  }
1001
1003
  }
@@ -2029,7 +2031,7 @@ function createFormControl(props = {}, flushRootRender) {
2029
2031
  : updateValidAndValue(name, true, options.value);
2030
2032
  return {
2031
2033
  ...(disabledIsDefined ? { disabled: options.disabled } : {}),
2032
- ...(_options.shouldUseNativeValidation || _options.progressive
2034
+ ...(_options.progressive
2033
2035
  ? {
2034
2036
  required: !!options.required,
2035
2037
  min: getRuleValue(options.min),