Explorer

definy.json-content-items

description
Read the JSON values from index as contents (ContentItem: contentHash and contentBytes) after accum. none if one of them is not
type
Fn(items: List<@definy.json>, index: Number, accum: List<@definy.content-item>) -> Union{#none, #some(List<@definy.content-item>)}
expression
fn(items$1004, index$1005, accum$1006) =>
  match @core.list-get(list: $1004, index: $1005) {
    #none(_) =>
      #some($1006),
    #some(item$1007) =>
      match @definy.json-get-string(value: $1007, key: "contentHash") {
        #none(_) =>
          #none,
        #some(hash$1008) =>
          match @definy.json-get-string(value: $1007, key: "contentBytes") {
            #none(_) =>
              #none,
            #some(bytes$1009) =>
              @definy.json-content-items(
                items: $1004,
                index: @core.plus(left: $1005, right: 1),
                accum: @core.list-concat(left: $1006, right: [{content_hash: $1008, content_bytes: $1009}])
              )
          }
      }
  }
visibility
public
definy.json-content-items (project definy, branch main, snapshot l0VFjJZP174d8CbZWFoujAGTYjgsQu4uTq5uWCZaXgo)
id: I1-qIYNmYVH1XJLpwYSeVYfdDXKNgh-1YqBzc01SpxM
content hash: QlH--pbliV3p3q8BI6txAYsBy-2AilHcM0eRNN8hfT8