MCPcopy Create free account
hub / github.com/dtmilano/AndroidViewClient / optimizeCb

Function optimizeCb

docs/_static/underscore-1.13.1.js:715–732  ·  view source on GitHub ↗
(func, context, argCount)

Source from the content-addressed store, hash-verified

713 // of the passed-in callback, to be repeatedly applied in other Underscore
714 // functions.
715 function optimizeCb(func, context, argCount) {
716 if (context === void 0) return func;
717 switch (argCount == null ? 3 : argCount) {
718 case 1: return function(value) {
719 return func.call(context, value);
720 };
721 // The 2-argument case is omitted because we’re not using it.
722 case 3: return function(value, index, collection) {
723 return func.call(context, value, index, collection);
724 };
725 case 4: return function(accumulator, value, index, collection) {
726 return func.call(context, accumulator, value, index, collection);
727 };
728 }
729 return function() {
730 return func.apply(context, arguments);
731 };
732 }
733
734 // An internal function to generate callbacks that can be applied to each
735 // element in a collection, returning the desired result — either `_.identity`,

Callers 5

baseIterateeFunction · 0.85
timesFunction · 0.85
eachFunction · 0.85
createReduceFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected