ary es-toolkit
Creates a new function that limits the number of arguments a function can accept.
Usage
ary(func, n)
Use ary when you want to limit the number of arguments a function can accept. Additional arguments passed are ignored. This is especially useful in functional programming to prevent callback functions from receiving unexpected arguments.
This is especially useful when used with array methods like map.
Parameters
funcFrequired
The function to limit the number of arguments.
nnumberrequired
The maximum number of arguments to accept.
Returns
A new function that accepts at most n arguments.
Source: es-toolkit
Re-exported verbatim from es-toolkit. Implementation, edge cases, and performance behavior are owned upstream. This page mirrors the documentation at the pinned version; the linked source is authoritative.