mumu 0.11.1

Lava Mumu is a language for those in the now and that know
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
{
  "id": "fn-array-pluck",
  "dataComponent": "array",
  "heading": {
    "title": "pluck",
    "badges": ["Array", "PARTIAL"]
  },
  "synopsis": "Returns an array containing the value at the given key from each keyed array in a MixedArray. Missing keys yield _ (placeholder). Partial usage and placeholders supported.",
  "codeBlocks": [
    "extend(\"array\")\n\nobjs = [ [a:1, b:2], [a:3], [b:4], [a:5, b:6] ]\nsput(array:pluck(\"a\", objs))\n# => [1,3,_,5]\n\n# Partial usage:\npluckA = array:pluck(\"a\")\nsput(pluckA(objs))\n# => [1,3,_,5]\n\n# Placeholder:\npartial = array:pluck(_, objs)\nsput(partial(\"b\"))\n# => [2,_,4,6]"
  ],
  "notes": [
    "Takes up to 2 arguments: (key, array).",
    "If only one argument or a placeholder is supplied, partial usage returns a function.",
    "Returns MixedArray, each value from the key or _ if missing.",
    "If the array is not a MixedArray of KeyedArrays, raises an error."
  ]
}