lib/client.js
function parseArgs() {
    var args = Array.prototype.slice.call(arguments);

    var ret = {
        query: args[0],
        params: [],
        options: {},
        callback: undefined,
        endCallback: undefined
    };

    args.shift();

    // If specified, params must be an array
    if (args[0] instanceof Array) {
        ret.params = args[0];
        args.shift();
    }

    // If specified, options must be a non-Function object
    if (! (args[0] instanceof Function)) {
        ret.options = args[0];
        args.shift();
    }

    ret.callback = args[0];
    ret.endCallback = args[1];

    if (ret.query === undefined || ret.callback === undefined) {
        throw new Error('query and callback are required');
    }

    return ret;
}
function parseArgs() {
    var args = Array.prototype.slice.call(arguments);

    var ret = {
        query: args[0],
        params: [],
        options: {},
        callback: undefined,
        endCallback: undefined
    };

    args.shift();

    // If specified, params must be an array
    if (args[0] instanceof Array) {
        ret.params = args[0];
        args.shift();
    }

    // If specified, options must be a non-Function object
    if (! (args[0] instanceof Function)) {
        ret.options = args[0];
        args.shift();
    }

    ret.callback = args[0];
    ret.endCallback = args[1];

    if (ret.query === undefined || ret.callback === undefined) {
        throw new Error('query and callback are required');
    }

    return ret;
}
function parseArgs ( ) { var args = Array . prototype . slice . call ( arguments ) ; var ret = { query : args [ 0 ] , params : [ ] , options : { } , callback : undefined , endCallback : undefined } ; args . shift ( ) ; // If specified, params must be an array if ( args [ 0 ] instanceof Array ) { ret . params = args [ 0 ] ; args . shift ( ) ; } // If specified, options must be a non-Function object if ( ! ( args [ 0 ] instanceof Function ) ) { ret . options = args [ 0 ] ; args . shift ( ) ; } ret . callback = args [ 0 ] ; ret . endCallback = args [ 1 ] ; if ( ret . query === undefined || ret . callback === undefined ) { throw new Error ( 'query and callback are required' ) ; } return ret ; }
Utility to parse the query function args
Utility to parse the query function args