src/mongo/shell/replsettest.js
/**
     * Wrap a function so it can accept a node id or connection as its first argument. The argument
     * is converted to a node id.
     */
Wrap a function so it can accept a node id or connection as its first argument. The argument
is converted to a node id.
Wrap a function so it can accept a node id or connection as its first argument . The argument is converted to a node id .
function _nodeParamToId(wrapped) {
        return function(node, ...wrappedArgs) {
            if (node.getDB) {
                return wrapped.call(this, self.getNodeId(node), ...wrappedArgs);
            }
            assert(Number.isInteger(node), `node must be an integer, not ${node}`);
            return wrapped.call(this, node, ...wrappedArgs);
        };
    }
function _nodeParamToId ( wrapped ) { return function ( node , ... wrappedArgs ) { if ( node . getDB ) { return wrapped . call ( this , self . getNodeId ( node ) , ... wrappedArgs ) ; } assert ( Number . isInteger ( node ) , ` ${ node } ` ) ; return wrapped . call ( this , node , ... wrappedArgs ) ; } ; }
Wrap a function so it can accept a node id or connection as its first argument.
Wrap a function so it can accept a node id or connection as its first argument .