Skip to content

Commit 283c8d6

Browse files
committed
fix(test): less fragile schema parsing in snippets check
1 parent 8bee1d6 commit 283c8d6

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

dial9-viewer/ui/test_all_skills_snippets.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,8 +252,10 @@ async function main() {
252252
function toSkeleton(val) {
253253
if (val === null || val === undefined) return '_null_';
254254
if (val instanceof Map) {
255-
const first = val.values().next().value;
256-
return { '_map_': first !== undefined ? toSkeleton(first) : '_empty_' };
255+
let rep;
256+
for (const v of val.values()) { if (!Array.isArray(v)) { rep = v; break; } }
257+
if (rep === undefined) rep = val.values().next().value;
258+
return { '_map_': rep !== undefined ? toSkeleton(rep) : '_empty_' };
257259
}
258260
if (typeof val === 'object' && typeof val.percentile === 'function') return 'Histogram';
259261
if (Array.isArray(val)) {

0 commit comments

Comments
 (0)