partial()

Creates a copy of a function with the left-most arguments preset.

This function is valid in v2.0.0 to v2.12.0. This function has been downloaded 11 times.

Parameters

{Function} fn
The function whose left-most arguments should be preset.
{Array} arrPresetArgs
An array containing all of the arguments to always be passed to the returned version of fn.
{boolean=} opt_presetFromRight Optional, Default:false
Boolean indicating if the preset arguments should always be passed after all other arguments. If false all preset arguments will precede the other arguments passed.

Returns

{Function}
A wrapper function which essentially acts as fn with the arrPresetArgs already being sent. The arguments in arrPresetArgs will be sent as the left-most arguments if opt_presetFromRight is not specified or false-ish, otherwise they will be sent as the right-most arguments.

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.