(func, context, argCount)
| 27917 | // of the passed-in callback, to be repeatedly applied in other Underscore |
| 27918 | // functions. |
| 27919 | var optimizeCb = function(func, context, argCount) { |
| 27920 | if (context === void 0) return func; |
| 27921 | switch (argCount == null ? 3 : argCount) { |
| 27922 | case 1: return function(value) { |
| 27923 | return func.call(context, value); |
| 27924 | }; |
| 27925 | case 2: return function(value, other) { |
| 27926 | return func.call(context, value, other); |
| 27927 | }; |
| 27928 | case 3: return function(value, index, collection) { |
| 27929 | return func.call(context, value, index, collection); |
| 27930 | }; |
| 27931 | case 4: return function(accumulator, value, index, collection) { |
| 27932 | return func.call(context, accumulator, value, index, collection); |
| 27933 | }; |
| 27934 | } |
| 27935 | return function() { |
| 27936 | return func.apply(context, arguments); |
| 27937 | }; |
| 27938 | }; |
| 27939 | |
| 27940 | // A mostly-internal function to generate callbacks that can be applied |
| 27941 | // to each element in a collection, returning the desired result — either |
no outgoing calls
no test coverage detected