Skip to content

Commit 6788385

Browse files
committed
Add test example.
1 parent c4ba210 commit 6788385

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

tests/tests/src/UntaggedVariants.mjs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -589,6 +589,17 @@ let MergeCases = {
589589
can_merge: can_merge
590590
};
591591

592+
function printLength(json) {
593+
if (typeof json !== "object" || json === null || Array.isArray(json)) {
594+
return;
595+
}
596+
console.log("Length: ", Object.values(json).length);
597+
}
598+
599+
let ObjectAndNull = {
600+
printLength: printLength
601+
};
602+
592603
let $$Array;
593604

594605
let i = 42;
@@ -641,5 +652,6 @@ export {
641652
Aliased,
642653
OnlyOne,
643654
MergeCases,
655+
ObjectAndNull,
644656
}
645657
/* l2 Not a pure module */

tests/tests/src/UntaggedVariants.res

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -461,3 +461,11 @@ module MergeCases = {
461461
| Boolean(_) => "merge"
462462
}
463463
}
464+
465+
module ObjectAndNull = {
466+
let printLength = (json: JSON.t) =>
467+
switch json {
468+
| Object(o) => Console.log2("Length: ", o->Dict.valuesToArray->Array.length)
469+
| _ => ()
470+
}
471+
}

0 commit comments

Comments
 (0)