4.17.11
3.10.1
2.4.2
1.3.1
_.before(n, func)
Creates a function that invokes func
, with the this
binding and arguments
of the created function, while it's called less than n
times. Subsequent
calls to the created function return the result of the last func
invocation.
Since
3.0.0
Arguments
argument
n
func
type
number
Function
description
The number of calls at which `func` is no longer invoked.
The function to restrict.
Returns
(array)
Example
jQuery(element).on(
"click",
_.before(5, addContactToList)
);
// => Allows adding up to 4 contacts to the list.
jQuery(element).on("click", _.before(5, addContactToList));
// => Allows adding up to 4 contacts to the list.