github.com/lmorg/murex@v0.0.0-20240217211045-e081c89cd4ef/docs/commands/map.md (about)

     1  # `map`
     2  
     3  > Creates a map from two data sources
     4  
     5  ## Description
     6  
     7  This takes two parameters - which are code blocks - and combines them to output a key/value map in JSON.
     8  
     9  The first block is the key and the second is the value.
    10  
    11  ## Usage
    12  
    13  ```
    14  map { code-block } { code-block } -> <stdout>
    15  ```
    16  
    17  ## Examples
    18  
    19  ```
    20  ยป map { tout json (["key 1", "key 2", "key 3"]) } { tout json (["value 1", "value 2", "value 3"]) } 
    21  {
    22      "key 1": "value 1",
    23      "key 2": "value 2",
    24      "key 3": "value 3"
    25  }
    26  ```
    27  
    28  ## See Also
    29  
    30  * [`[ ..Range ]`](../parser/range.md):
    31    Outputs a ranged subset of data from STDIN
    32  * [`[ Index ]`](../parser/item-index.md):
    33    Outputs an element from an array, map or table
    34  * [`[[ Element ]]`](../parser/element.md):
    35    Outputs an element from a nested structure
    36  * [`a` (mkarray)](../commands/a.md):
    37    A sophisticated yet simple way to build an array or list
    38  * [`alter`](../commands/alter.md):
    39    Change a value within a structured data-type and pass that change along the pipeline without altering the original source input
    40  * [`append`](../commands/append.md):
    41    Add data to the end of an array
    42  * [`count`](../commands/count.md):
    43    Count items in a map, list or array
    44  * [`ja` (mkarray)](../commands/ja.md):
    45    A sophisticated yet simply way to build a JSON array
    46  * [`jsplit` ](../commands/jsplit.md):
    47    Splits STDIN into a JSON array based on a regex parameter
    48  * [`prepend`](../commands/prepend.md):
    49    Add data to the start of an array
    50  
    51  <hr/>
    52  
    53  This document was generated from [builtins/core/arraytools/map_doc.yaml](https://github.com/lmorg/murex/blob/master/builtins/core/arraytools/map_doc.yaml).