@conform-to/dom 1.1.0 → 1.1.1

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.
package/README CHANGED
@@ -8,7 +8,7 @@
8
8
  ╚══════╝ ╚═════╝ ╚═╝ ╚══╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝
9
9
 
10
10
 
11
- Version 1.1.0 / License MIT / Copyright (c) 2024 Edmund Hung
11
+ Version 1.1.1 / License MIT / Copyright (c) 2024 Edmund Hung
12
12
 
13
13
  A type-safe form validation library utilizing web fundamentals to progressively enhance HTML Forms with full support for server frameworks like Remix and Next.js.
14
14
 
package/formdata.js CHANGED
@@ -34,7 +34,7 @@ function getPaths(name) {
34
34
  return [];
35
35
  }
36
36
  return name.split(/\.|(\[\d*\])/).reduce((result, segment) => {
37
- if (typeof segment !== 'undefined' && segment !== '') {
37
+ if (typeof segment !== 'undefined' && segment !== '' && segment !== '__proto__' && segment !== 'constructor' && segment !== 'prototype') {
38
38
  if (segment.startsWith('[') && segment.endsWith(']')) {
39
39
  var index = segment.slice(1, -1);
40
40
  result.push(Number(index));
@@ -91,10 +91,9 @@ function setValue(target, name, valueFn) {
91
91
  var index = -1;
92
92
  var pointer = target;
93
93
  while (pointer != null && ++index < length) {
94
- var _pointer$key;
95
94
  var key = paths[index];
96
95
  var nextKey = paths[index + 1];
97
- var newValue = index != lastIndex ? (_pointer$key = pointer[key]) !== null && _pointer$key !== void 0 ? _pointer$key : typeof nextKey === 'number' ? [] : {} : valueFn(pointer[key]);
96
+ var newValue = index != lastIndex ? Object.hasOwn(pointer, key) ? pointer[key] : typeof nextKey === 'number' ? [] : {} : valueFn(pointer[key]);
98
97
  pointer[key] = newValue;
99
98
  pointer = pointer[key];
100
99
  }
@@ -109,6 +108,9 @@ function getValue(target, name) {
109
108
  if (typeof pointer === 'undefined' || pointer == null) {
110
109
  break;
111
110
  }
111
+ if (!Object.hasOwn(pointer, path)) {
112
+ return;
113
+ }
112
114
  if (isPlainObject(pointer) && typeof path === 'string') {
113
115
  pointer = pointer[path];
114
116
  } else if (Array.isArray(pointer) && typeof path === 'number') {
package/formdata.mjs CHANGED
@@ -30,7 +30,7 @@ function getPaths(name) {
30
30
  return [];
31
31
  }
32
32
  return name.split(/\.|(\[\d*\])/).reduce((result, segment) => {
33
- if (typeof segment !== 'undefined' && segment !== '') {
33
+ if (typeof segment !== 'undefined' && segment !== '' && segment !== '__proto__' && segment !== 'constructor' && segment !== 'prototype') {
34
34
  if (segment.startsWith('[') && segment.endsWith(']')) {
35
35
  var index = segment.slice(1, -1);
36
36
  result.push(Number(index));
@@ -87,10 +87,9 @@ function setValue(target, name, valueFn) {
87
87
  var index = -1;
88
88
  var pointer = target;
89
89
  while (pointer != null && ++index < length) {
90
- var _pointer$key;
91
90
  var key = paths[index];
92
91
  var nextKey = paths[index + 1];
93
- var newValue = index != lastIndex ? (_pointer$key = pointer[key]) !== null && _pointer$key !== void 0 ? _pointer$key : typeof nextKey === 'number' ? [] : {} : valueFn(pointer[key]);
92
+ var newValue = index != lastIndex ? Object.hasOwn(pointer, key) ? pointer[key] : typeof nextKey === 'number' ? [] : {} : valueFn(pointer[key]);
94
93
  pointer[key] = newValue;
95
94
  pointer = pointer[key];
96
95
  }
@@ -105,6 +104,9 @@ function getValue(target, name) {
105
104
  if (typeof pointer === 'undefined' || pointer == null) {
106
105
  break;
107
106
  }
107
+ if (!Object.hasOwn(pointer, path)) {
108
+ return;
109
+ }
108
110
  if (isPlainObject(pointer) && typeof path === 'string') {
109
111
  pointer = pointer[path];
110
112
  } else if (Array.isArray(pointer) && typeof path === 'number') {
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "A set of opinionated helpers built on top of the Constraint Validation API",
4
4
  "homepage": "https://conform.guide",
5
5
  "license": "MIT",
6
- "version": "1.1.0",
6
+ "version": "1.1.1",
7
7
  "main": "index.js",
8
8
  "module": "index.mjs",
9
9
  "types": "index.d.ts",