about summary refs log tree commit diff stats
path: root/js/scripting-lang/scratch_tests/validate_table_scrap.txt
diff options
context:
space:
mode:
Diffstat (limited to 'js/scripting-lang/scratch_tests/validate_table_scrap.txt')
-rw-r--r--js/scripting-lang/scratch_tests/validate_table_scrap.txt21
1 files changed, 21 insertions, 0 deletions
diff --git a/js/scripting-lang/scratch_tests/validate_table_scrap.txt b/js/scripting-lang/scratch_tests/validate_table_scrap.txt
new file mode 100644
index 0000000..0e937c9
--- /dev/null
+++ b/js/scripting-lang/scratch_tests/validate_table_scrap.txt
@@ -0,0 +1,21 @@
+/* Validate user input data */
+users : {
+  user1: {name: "Alice", email: "alice@example.com", age: 25},
+  user2: {name: "", email: "invalid-email", age: -5},
+  user3: {name: "Charlie", email: "charlie@test.com", age: 30}
+};
+
+/* Simple validation example */
+is_valid_name : user -> 
+  when user.name = "" is
+    true then false
+    _ then true;
+
+is_valid_age : user -> 
+  when user.age > 0 is
+    true then true
+    _ then false;
+
+/* Apply validation to all users */
+valid_names : map @is_valid_name users;
+valid_ages : map @is_valid_age users;