source: frontend/node_modules/underscore/amd/_optimizeCb.js

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 11 days ago

Fix frontend appearance

  • Property mode set to 100644
File size: 886 bytes
Line 
1define(function () {
2
3 // Internal function that returns an efficient (for current engines) version
4 // of the passed-in callback, to be repeatedly applied in other Underscore
5 // functions.
6 function optimizeCb(func, context, argCount) {
7 if (context === void 0) return func;
8 switch (argCount == null ? 3 : argCount) {
9 case 1: return function(value) {
10 return func.call(context, value);
11 };
12 // The 2-argument case is omitted because we’re not using it.
13 case 3: return function(value, index, collection) {
14 return func.call(context, value, index, collection);
15 };
16 case 4: return function(accumulator, value, index, collection) {
17 return func.call(context, accumulator, value, index, collection);
18 };
19 }
20 return function() {
21 return func.apply(context, arguments);
22 };
23 }
24
25 return optimizeCb;
26
27});
Note: See TracBrowser for help on using the repository browser.