@ai-sdk/google 3.0.81 → 3.0.83

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.
@@ -1159,11 +1159,25 @@ function parsePath(rawPath) {
1159
1159
  }
1160
1160
  return segments;
1161
1161
  }
1162
+ var hasOwn = Object.prototype.hasOwnProperty;
1163
+ function hasOwnProperty(obj, key) {
1164
+ return hasOwn.call(obj, key);
1165
+ }
1166
+ function defineOwnProperty(obj, key, value) {
1167
+ Object.defineProperty(obj, key, {
1168
+ value,
1169
+ enumerable: true,
1170
+ configurable: true,
1171
+ writable: true
1172
+ });
1173
+ }
1162
1174
  function getNestedValue(obj, segments) {
1163
1175
  let current = obj;
1164
1176
  for (const seg of segments) {
1165
1177
  if (current == null || typeof current !== "object") return void 0;
1166
- current = current[seg];
1178
+ const currentRecord = current;
1179
+ if (!hasOwnProperty(currentRecord, seg)) return void 0;
1180
+ current = currentRecord[seg];
1167
1181
  }
1168
1182
  return current;
1169
1183
  }
@@ -1172,12 +1186,12 @@ function setNestedValue(obj, segments, value) {
1172
1186
  for (let i = 0; i < segments.length - 1; i++) {
1173
1187
  const seg = segments[i];
1174
1188
  const nextSeg = segments[i + 1];
1175
- if (current[seg] == null) {
1176
- current[seg] = typeof nextSeg === "number" ? [] : {};
1189
+ if (!hasOwnProperty(current, seg) || current[seg] == null) {
1190
+ defineOwnProperty(current, seg, typeof nextSeg === "number" ? [] : {});
1177
1191
  }
1178
1192
  current = current[seg];
1179
1193
  }
1180
- current[segments[segments.length - 1]] = value;
1194
+ defineOwnProperty(current, segments[segments.length - 1], value);
1181
1195
  }
1182
1196
  function resolvePartialArgValue(arg) {
1183
1197
  var _a, _b;