{
"id": "fn-array-prop",
"dataComponent": "array",
"heading": {
"title": "prop",
"badges": ["Array", "PARTIAL"]
},
"synopsis": "Retrieves the value of a specified key from a keyed array. Supports partial usage and placeholders for the key or the object (or both).",
"codeBlocks": [
"extend(\"array\")\\n\\nkeyedExample = [ name:\"Alice\", city:\"Paris\" ]\\n\\nsput( array:prop(\"name\", keyedExample) )\\n// => \"Alice\"\\n\\n# Partial usage => known key, missing object\\ngetCity = array:prop(\"city\")\\nsput( getCity(keyedExample) )\\n// => \"Paris\"\\n\\n# Placeholder => known object, missing key\\ngetSomething = array:prop(_, keyedExample)\\nsput( getSomething(\"name\") )\\n// => \"Alice\""
],
"notes": [
"If both a key (string) and a keyed array are provided, the value for that key is returned immediately.",
"If only one of them is provided, returns a partial function that expects the missing argument.",
"Raises an error if the object is not a keyed array or if the key is not a valid single string."
]
}