browser/specs/validate-options.spec.js
function createReduce(dir) {
                    // Optimized iterator function as using arguments.length
                    // in the main function will deoptimize the, see #1991.
                    function iterator(obj, iteratee, memo, keys, index, length) {
                        for (; index >= 0 && index < length; index += dir) {
                            var currentKey = keys ? keys[index] : index;
                            memo = iteratee(memo, obj[currentKey], currentKey, obj);
                        }
                        return memo;
                    }
                    return function (obj, iteratee, memo, context) {
                        iteratee = optimizeCb(iteratee, context, 4);
                        var keys = !isArrayLike(obj) && _.keys(obj), length = (keys || obj).length, index = dir > 0 ? 0 : length - 1;    // Determine the initial value if none is provided.
                        // Determine the initial value if none is provided.
                        if (arguments.length < 3) {
                            memo = obj[keys ? keys[index] : index];
                            index += dir;
                        }
                        return iterator(obj, iteratee, memo, keys, index, length);
                    };
                }
function createReduce(dir) {
                    // Optimized iterator function as using arguments.length
                    // in the main function will deoptimize the, see #1991.
                    function iterator(obj, iteratee, memo, keys, index, length) {
                        for (; index >= 0 && index < length; index += dir) {
                            var currentKey = keys ? keys[index] : index;
                            memo = iteratee(memo, obj[currentKey], currentKey, obj);
                        }
                        return memo;
                    }
                    return function (obj, iteratee, memo, context) {
                        iteratee = optimizeCb(iteratee, context, 4);
                        var keys = !isArrayLike(obj) && _.keys(obj), length = (keys || obj).length, index = dir > 0 ? 0 : length - 1;    // Determine the initial value if none is provided.
                        // Determine the initial value if none is provided.
                        if (arguments.length < 3) {
                            memo = obj[keys ? keys[index] : index];
                            index += dir;
                        }
                        return iterator(obj, iteratee, memo, keys, index, length);
                    };
                }
function createReduce ( dir ) { // Optimized iterator function as using arguments.length // in the main function will deoptimize the, see #1991. function iterator ( obj , iteratee , memo , keys , index , length ) { for ( ; index >= 0 && index < length ; index += dir ) { var currentKey = keys ? keys [ index ] : index ; memo = iteratee ( memo , obj [ currentKey ] , currentKey , obj ) ; } return memo ; } return function ( obj , iteratee , memo , context ) { iteratee = optimizeCb ( iteratee , context , 4 ) ; var keys = ! isArrayLike ( obj ) && _ . keys ( obj ) , length = ( keys || obj ) . length , index = dir > 0 ? 0 : length - 1 ; // Determine the initial value if none is provided. // Determine the initial value if none is provided. if ( arguments . length < 3 ) { memo = obj [ keys ? keys [ index ] : index ] ; index += dir ; } return iterator ( obj , iteratee , memo , keys , index , length ) ; } ; }
Create a reducing function iterating left or right. Create a reducing function iterating left or right.
Create a reducing function iterating left or right . Create a reducing function iterating left or right .