dist/underscore-contrib.js
function(fun) {
      var funLength = fun.length;

      if (funLength < 1) {
        return fun;
      }
      else if (funLength === 1)  {
        return function () {
          return fun.call(this, __slice.call(arguments, 0));
        };
      }
      else {
        return function () {
          var numberOfArgs = arguments.length,
              namedArgs = __slice.call(arguments, 0, funLength - 1),
              numberOfMissingNamedArgs = Math.max(funLength - numberOfArgs - 1, 0),
              argPadding = new Array(numberOfMissingNamedArgs),
              variadicArgs = __slice.call(arguments, fun.length - 1);

          return fun.apply(this, namedArgs.concat(argPadding).concat([variadicArgs]));
        };
      }
    }
function(fun) {
      var funLength = fun.length;

      if (funLength < 1) {
        return fun;
      }
      else if (funLength === 1)  {
        return function () {
          return fun.call(this, __slice.call(arguments, 0));
        };
      }
      else {
        return function () {
          var numberOfArgs = arguments.length,
              namedArgs = __slice.call(arguments, 0, funLength - 1),
              numberOfMissingNamedArgs = Math.max(funLength - numberOfArgs - 1, 0),
              argPadding = new Array(numberOfMissingNamedArgs),
              variadicArgs = __slice.call(arguments, fun.length - 1);

          return fun.apply(this, namedArgs.concat(argPadding).concat([variadicArgs]));
        };
      }
    }
function ( fun ) { var funLength = fun . length ; if ( funLength < 1 ) { return fun ; } else if ( funLength === 1 ) { return function ( ) { return fun . call ( this , __slice . call ( arguments , 0 ) ) ; } ; } else { return function ( ) { var numberOfArgs = arguments . length , namedArgs = __slice . call ( arguments , 0 , funLength - 1 ) , numberOfMissingNamedArgs = Math . max ( funLength - numberOfArgs - 1 , 0 ) , argPadding = new Array ( numberOfMissingNamedArgs ) , variadicArgs = __slice . call ( arguments , fun . length - 1 ) ; return fun . apply ( this , namedArgs . concat ( argPadding ) . concat ( [ variadicArgs ] ) ) ; } ; } }
Takes a function expecting an array and returns a function that takes varargs and wraps all in an array that is passed to the original function.
Takes a function expecting an array and returns a function that takes varargs and wraps all in an array that is passed to the original function .