Explorer

core.record-literal-find

description
(en) The value of the field key in a record literal
type
Fn(fields: List<Record{key: String, value: @core.expression}>, key: String, index: Number) -> Union{#none, #some(@core.expression)}
expression
fn(fields$0, key$1, index$2) =>
  match @core.list-get(list: $0, index: $2) {
    #none(_) =>
      #none,
    #some(item$3) =>
      match @core.equal(left: $3.key, right: $1) {
        true =>
          #some($3.value),
        false =>
          @core.record-literal-find(fields: $0, key: $1, index: @core.plus(left: $2, right: 1))
      }
  }
visibility
public
core.record-literal-find (project definy, branch main, snapshot CfIAXM725tR74SWd4aoTUz4-JJQfqnllblZbQ2Sv204)
id: tMYavz7p8nxufn738b72QhVX6pQaPsfEHt8H5uL8caE
content hash: eSwGebOOx_g0GjmowESLPTeR3q33k6TiGSGZSjpNv4I