_bindCb4.js 479 B

12345678910111213
  1. // In Firefox, `Function.prototype.call` is faster than
  2. // `Function.prototype.apply`. In the optimized variant of
  3. // `bindCb` below, we exploit the fact that no Underscore
  4. // function passes more than four arguments to a callback.
  5. // **NOT general enough for use outside of Underscore.**
  6. function bindCb4(func, context) {
  7. if (context === void 0) return func;
  8. return function(a1, a2, a3, a4) {
  9. return func.call(context, a1, a2, a3, a4);
  10. };
  11. }
  12. module.exports = bindCb4;