Native OCaml Rego/OPA policy engine
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

ocaml-rego: Value.field on a Set is set-membership

OPA s.k shorthand for sets returns the element if k is in the set,
otherwise undefined.

+6
+6
lib/value.ml
··· 130 130 | Object pairs -> ( 131 131 let k = String key in 132 132 match List.assoc_opt k pairs with Some v -> v | None -> Undefined) 133 + | Set xs -> 134 + (* For sets, [s.k] is shorthand for set-membership: returns the 135 + element when present, undefined when absent. *) 136 + let target = String key in 137 + if List.exists (fun v -> compare target v = 0) xs then target 138 + else Undefined 133 139 | _ -> Undefined 134 140 135 141 let index idx = function