cli4ai 1.2.7 → 1.2.8
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.
|
@@ -333,8 +333,14 @@ function getPath(root, segments) {
|
|
|
333
333
|
if (current === null || current === undefined)
|
|
334
334
|
return undefined;
|
|
335
335
|
if (Array.isArray(current)) {
|
|
336
|
+
// Handle array properties like "length" first
|
|
337
|
+
if (seg === 'length') {
|
|
338
|
+
current = current.length;
|
|
339
|
+
continue;
|
|
340
|
+
}
|
|
341
|
+
// Then try numeric index access
|
|
336
342
|
const idx = Number(seg);
|
|
337
|
-
if (!Number.isInteger(idx))
|
|
343
|
+
if (!Number.isInteger(idx) || idx < 0)
|
|
338
344
|
return undefined;
|
|
339
345
|
current = current[idx];
|
|
340
346
|
continue;
|