From 1c63d870cef891cf408855ceffa1fcbb950e0622 Mon Sep 17 00:00:00 2001 From: Pedro Castro Date: Fri, 7 Jun 2024 21:54:33 -0300 Subject: [PATCH] handle more than one property --- src/bindings/Babel.res | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/bindings/Babel.res b/src/bindings/Babel.res index 46b36475d..2726555e4 100644 --- a/src/bindings/Babel.res +++ b/src/bindings/Babel.res @@ -59,15 +59,17 @@ module PlaygroundValidator = { switch (firstDeclaration.id, firstDeclaration.init) { | (Identifier({name}), Some(init)) if name === "App" => switch init->Null.toOption { - | Some(ObjectExpression({ - properties: [ - ObjectProperty({ + | Some(ObjectExpression({properties})) => + let foundEntryPoint = properties->Array.find(property => { + switch property { + | ObjectProperty({ key: Identifier({name: "make"}), value: Identifier({name: "Playground$App"}), - }), - ], - })) => - entryPoint.contents = true + }) => true + | _ => false + } + }) + entryPoint.contents = Option.isSome(foundEntryPoint) | _ => () } | _ => ()