src/mongo/shell/replsettest.js
/**
     * Wrap a function so it accepts a single node or list of them as its first argument. The
     * function is called once per node provided.
     */
Wrap a function so it accepts a single node or list of them as its first argument. The
function is called once per node provided.
Wrap a function so it accepts a single node or list of them as its first argument . The function is called once per node provided .
function _nodeParamToSingleNode(wrapped) {
        return function(node, ...wrappedArgs) {
            if (node.hasOwnProperty('length')) {
                let returnValueList = [];
                for (let i = 0; i < node.length; i++) {
                    returnValueList.push(wrapped.call(this, node[i], ...wrappedArgs));
                }
                return returnValueList;
            }
            return wrapped.call(this, node, ...wrappedArgs);
        };
    }
function _nodeParamToSingleNode ( wrapped ) { return function ( node , ... wrappedArgs ) { if ( node . hasOwnProperty ( 'length' ) ) { let returnValueList = [ ] ; for ( let i = 0 ; i < node . length ; i ++ ) { returnValueList . push ( wrapped . call ( this , node [ i ] , ... wrappedArgs ) ) ; } return returnValueList ; } return wrapped . call ( this , node , ... wrappedArgs ) ; } ; }
Wrap a function so it accepts a single node or list of them as its first argument.
Wrap a function so it accepts a single node or list of them as its first argument .