bin/cli.js
function(db, mname, frc) {
            return function() {
                var cname = arguments[0];
                var args = [cname];
                // copy all arguments except first and last
                for(var i = 1; i < arguments.length - 1; ++i) {
                    args.push(arguments[i]);
                }

                // creating callback with collection rebuilding
                var ccb = function(rcb) {
                    return function() {
                        if (frc || !db[cname]) {
                            bindColCtls(db);
                        }
                        if (rcb) {
                            rcb.apply(this, arguments);
                        }
                    }
                };

                if (arguments.length > 1) {
                    if (typeof arguments[arguments.length - 1] === 'function') {
                        // wrap existing callback
                        args.push(ccb(arguments[arguments.length - 1]));
                    } else {
                        // adding registering callback after last argument
                        args.push(arguments[arguments.length - 1]);
                        args.push(ccb());
                    }
                } else {
                    args.push(ccb());
                }

                return cdb.jb[mname].apply(cdb.jb, args);
            }
        }
function(db, mname, frc) {
            return function() {
                var cname = arguments[0];
                var args = [cname];
                // copy all arguments except first and last
                for(var i = 1; i < arguments.length - 1; ++i) {
                    args.push(arguments[i]);
                }

                // creating callback with collection rebuilding
                var ccb = function(rcb) {
                    return function() {
                        if (frc || !db[cname]) {
                            bindColCtls(db);
                        }
                        if (rcb) {
                            rcb.apply(this, arguments);
                        }
                    }
                };

                if (arguments.length > 1) {
                    if (typeof arguments[arguments.length - 1] === 'function') {
                        // wrap existing callback
                        args.push(ccb(arguments[arguments.length - 1]));
                    } else {
                        // adding registering callback after last argument
                        args.push(arguments[arguments.length - 1]);
                        args.push(ccb());
                    }
                } else {
                    args.push(ccb());
                }

                return cdb.jb[mname].apply(cdb.jb, args);
            }
        }
function ( db , mname , frc ) { return function ( ) { var cname = arguments [ 0 ] ; var args = [ cname ] ; // copy all arguments except first and last for ( var i = 1 ; i < arguments . length - 1 ; ++ i ) { args . push ( arguments [ i ] ) ; } // creating callback with collection rebuilding var ccb = function ( rcb ) { return function ( ) { if ( frc || ! db [ cname ] ) { bindColCtls ( db ) ; } if ( rcb ) { rcb . apply ( this , arguments ) ; } } } ; if ( arguments . length > 1 ) { if ( typeof arguments [ arguments . length - 1 ] === 'function' ) { // wrap existing callback args . push ( ccb ( arguments [ arguments . length - 1 ] ) ) ; } else { // adding registering callback after last argument args . push ( arguments [ arguments . length - 1 ] ) ; args . push ( ccb ( ) ) ; } } else { args . push ( ccb ( ) ) ; } return cdb . jb [ mname ] . apply ( cdb . jb , args ) ; } }
db - db controller mname - method name frc - force rebind collections controllers. if <code>false</code> db meta will be reloaded only if method executes on unknown collection. argl - arguments count (for register callback as last argument)
db - db controller mname - method name frc - force rebind collections controllers . if <code > false< / code > db meta will be reloaded only if method executes on unknown collection . argl - arguments count ( for register callback as last argument )