restParam()

Creates a wrapper function that if called with more arguments than specified, those arguments will be passed in as an array in the final argument.

This function is valid in v2.0.0 to v2.14.0. This function has been downloaded 46 times.

Parameters

{Function} fn
The function to call with the normal parameters followed by the rest parameter in its place as specified by opt_start.
{number=} opt_start Optional, Default:fn.length-1
The index within the arguments passed to the returned function that will start the summary of the rest parameter.

Returns

{Function}
Returns a function that when invoked will call fn, but if there are any that have an index greater or equal to opt_start they will be passed in as the last parameter which will be an array.

Required Function

This function requires the following function which is included automatically:

  • slice()
    Slice does not modify the original array, but instead returns a shallow copy of elements from the original array.