{
"id": "fn-array-find",
"dataComponent": "array",
"heading": {
"title": "find",
"badges": ["Array", "PARTIAL"]
},
"synopsis": "Returns the first element in an array that matches a predicate function. Returns '_' if not found. Supports partial usage and placeholders.",
"codeBlocks": [
"extend(\"array\")\n\narray:find(x => x > 10, [4,8,15,16,23,42])\n// => 15\n\n# Partial usage:\nmyFinder = array:find(x => x == 42)\nmyFinder([40,41,42,43])\n// => 42\n\n# Placeholder usage:\npartial = array:find(_, [5,6,7,8])\npartial(x => x == 7)\n// => 7"
],
"notes": [
"Accepts up to two arguments: (predicateFn, array).",
"If called with one argument or placeholders, returns a partial function.",
"Returns the first matching element, or '_' if none found."
]
}