vendor/optional/lodash-0.3.2.js
function bind(func, thisArg) {
    var methodName,
        isFunc = toString.call(func) == funcClass;

    // juggle arguments
    if (!isFunc) {
      methodName = thisArg;
      thisArg = func;
    }
    // use if `Function#bind` is faster
    else if (nativeBind) {
      return nativeBind.call.apply(nativeBind, arguments);
    }

    var partialArgs = slice.call(arguments, 2);

    function bound() {
      // `Function#bind` spec
      // http://es5.github.com/#x15.3.4.5
      var args = arguments,
          thisBinding = thisArg;

      if (!isFunc) {
        func = thisArg[methodName];
      }
      if (partialArgs.length) {
        args = args.length
          ? concat.apply(partialArgs, args)
          : partialArgs;
      }
      if (this instanceof bound) {
        // get `func` instance if `bound` is invoked in a `new` expression
        noop.prototype = func.prototype;
        thisBinding = new noop;

        // mimic the constructor's `return` behavior
        // http://es5.github.com/#x13.2.2
        var result = func.apply(thisBinding, args);
        return valueTypes[typeof result] && result !== null
          ? result
          : thisBinding
      }
      return func.apply(thisBinding, args);
    }

    return bound;
  }
function bind(func, thisArg) {
    var methodName,
        isFunc = toString.call(func) == funcClass;

    // juggle arguments
    if (!isFunc) {
      methodName = thisArg;
      thisArg = func;
    }
    // use if `Function#bind` is faster
    else if (nativeBind) {
      return nativeBind.call.apply(nativeBind, arguments);
    }

    var partialArgs = slice.call(arguments, 2);

    function bound() {
      // `Function#bind` spec
      // http://es5.github.com/#x15.3.4.5
      var args = arguments,
          thisBinding = thisArg;

      if (!isFunc) {
        func = thisArg[methodName];
      }
      if (partialArgs.length) {
        args = args.length
          ? concat.apply(partialArgs, args)
          : partialArgs;
      }
      if (this instanceof bound) {
        // get `func` instance if `bound` is invoked in a `new` expression
        noop.prototype = func.prototype;
        thisBinding = new noop;

        // mimic the constructor's `return` behavior
        // http://es5.github.com/#x13.2.2
        var result = func.apply(thisBinding, args);
        return valueTypes[typeof result] && result !== null
          ? result
          : thisBinding
      }
      return func.apply(thisBinding, args);
    }

    return bound;
  }
function bind ( func , thisArg ) { var methodName , isFunc = toString . call ( func ) == funcClass ; // juggle arguments if ( ! isFunc ) { methodName = thisArg ; thisArg = func ; } // use if `Function#bind` is faster else if ( nativeBind ) { return nativeBind . call . apply ( nativeBind , arguments ) ; } var partialArgs = slice . call ( arguments , 2 ) ; function bound ( ) { // `Function#bind` spec // http://es5.github.com/#x15.3.4.5 var args = arguments , thisBinding = thisArg ; if ( ! isFunc ) { func = thisArg [ methodName ] ; } if ( partialArgs . length ) { args = args . length ? concat . apply ( partialArgs , args ) : partialArgs ; } if ( this instanceof bound ) { // get `func` instance if `bound` is invoked in a `new` expression noop . prototype = func . prototype ; thisBinding = new noop ; // mimic the constructor's `return` behavior // http://es5.github.com/#x13.2.2 var result = func . apply ( thisBinding , args ) ; return valueTypes [ typeof result ] && result !== null ? result : thisBinding } return func . apply ( thisBinding , args ) ; } return bound ; }
Creates a new function that, when called, invokes `func` with the `this`
binding of `thisArg` and prepends any additional `bind` arguments to those
passed to the bound function. Lazy defined methods may be bound by passing
the object they are bound to as `func` and the method name as `thisArg`.

@static
@memberOf _
@category Functions
@param {Function|Object} func The function to bind or the object the method belongs to.
@param {Mixed} [thisArg] The `this` binding of `func` or the method name.
@param {Mixed} [arg1, arg2, ...] Arguments to be partially applied.
@returns {Function} Returns the new bound function.
@example

// basic bind
var func = function(greeting) {
return greeting + ': ' + this.name;
};

func = _.bind(func, { 'name': 'moe' }, 'hi');
func();
// => 'hi: moe'

// lazy bind
var object = {
'name': 'moe',
'greet': function(greeting) {
return greeting + ': ' + this.name;
}
};

var func = _.bind(object, 'greet', 'hi');
func();
// => 'hi: moe'

object.greet = function(greeting) {
return greeting + ', ' + this.name + '!';
};

func();
// => 'hi, moe!'
Creates a new function that when called invokes func with the this binding of thisArg and prepends any additional bind arguments to those passed to the bound function . Lazy defined methods may be bound by passing the object they are bound to as func and the method name as thisArg .