Explorer

definy.mcp-read-descriptions

description
Read descriptions of a definy_create_snapshot change: an object from a language code (en, ja, eo) to the text ('' removes that language). Values that are not strings are ignored
type
Fn(value: Union{#none, #some(@definy.json)}) -> List<@core.localized-text>
expression
fn(value$0) =>
  match $0 {
    #some(json$1) =>
      match $1 {
        #object(entries$2) =>
          @core.list-fold(
            T: Record{key: String, value: @definy.json},
            A: List<@core.localized-text>,
            reducer: fn(acc$3, item$4) =>
              match $4.value {
                #string(text$5) =>
                  @core.list-append(list: $3, item: {language: $4.key, text: $5}),
                _ =>
                  $3
              },
            init: [],
            xs: $2
          ),
        _ =>
          []
      },
    #none(_) =>
      []
  }
visibility
public
definy.mcp-read-descriptions (project definy, branch main, snapshot l0VFjJZP174d8CbZWFoujAGTYjgsQu4uTq5uWCZaXgo)
id: Ml6t461gwHu2OeOqNIhhqtr9lG-KBNlBc06_FvHYTuE
content hash: 4OvJUVuo4kzKOK_4ApbbXXs65KvvYhrEq8ehHRx3Vtw