Update underscore.js to 1.13.6

This commit is contained in:
Konstantin Kireyev
2024-03-06 21:54:19 +05:00
parent fdb13cb1de
commit 76bd9973a0
393 changed files with 196028 additions and 5989 deletions

View File

@ -0,0 +1,21 @@
// Internal function that returns an efficient (for current engines) version
// of the passed-in callback, to be repeatedly applied in other Underscore
// functions.
export default function optimizeCb(func, context, argCount) {
if (context === void 0) return func;
switch (argCount == null ? 3 : argCount) {
case 1: return function(value) {
return func.call(context, value);
};
// The 2-argument case is omitted because were not using it.
case 3: return function(value, index, collection) {
return func.call(context, value, index, collection);
};
case 4: return function(accumulator, value, index, collection) {
return func.call(context, accumulator, value, index, collection);
};
}
return function() {
return func.apply(context, arguments);
};
}