Creates a function that limits the number of times the given function (func
) can be called.
The number of times the returned function is allowed to call func
before stopping.
n
is 0, func
will never be called.n
is a positive integer, func
will be called up to n-1
times.The function to be called with the limit applied.
func
until the n-1
-th call.undefined
if the number of calls reaches or exceeds n
, stopping further calls.
Alias