Binder

About

This subclass of Functor is used to bind a function to a This value and/or to a list of parameters.

API

constructor()

constructor(thisObj : any; func : Callable; partialParams : Collection; prependParams : Boolean)

Creates a Functor whose .call(), .apply() and .f() functions will call func, passing whatever parameters are passed to .call() or .apply() along with partialParams.

If thisObj is null, the first parameter passed to .call() or .apply() will be used as the This object, otherwise thisObj will be used as the This object.

If prependParams is true (the default), partialParams will be prepended to the parameters passed to .call() or .apply(). Otherwise partialParams is appended.

TIP

Usually you will not instantiate this class directly, but will use _.bind and _.bindRight instead, which instantiates this class for you. See those functions for examples of using Binder.

Last Updated:
Contributors: Aparajita