lib/primitive.js
function orderby (args, order) {
    if (this.typecheck) t.typecheck('orderby', [args, order]);
    
    var o = (order&&'string'===typeof order) ? order : '';
    var result = [];

    if ('string'===typeof args) {
        result = o ? [args+' '+o] : [args];
    }
    else if (args instanceof Array) {
        for (var i=0; i < args.length; i++) {
            if ('string'===typeof args[i]) {
                o ? result.push(args[i]+' '+o) : result.push(args[i]);
            }
            else if ('object'===typeof args[i]) {
                var key = Object.keys(args[i])[0];
                result.push(key+' '+args[i][key]);
            }
        }
    }
    else if (args instanceof Object) {
        var key = Object.keys(args)[0];
        result = [key+' '+args[key]];
    }

    return 'order by '+result.join();
}
function orderby (args, order) {
    if (this.typecheck) t.typecheck('orderby', [args, order]);
    
    var o = (order&&'string'===typeof order) ? order : '';
    var result = [];

    if ('string'===typeof args) {
        result = o ? [args+' '+o] : [args];
    }
    else if (args instanceof Array) {
        for (var i=0; i < args.length; i++) {
            if ('string'===typeof args[i]) {
                o ? result.push(args[i]+' '+o) : result.push(args[i]);
            }
            else if ('object'===typeof args[i]) {
                var key = Object.keys(args[i])[0];
                result.push(key+' '+args[i][key]);
            }
        }
    }
    else if (args instanceof Object) {
        var key = Object.keys(args)[0];
        result = [key+' '+args[key]];
    }

    return 'order by '+result.join();
}
function orderby ( args , order ) { if ( this . typecheck ) t . typecheck ( 'orderby' , [ args , order ] ) ; var o = ( order && 'string' === typeof order ) ? order : '' ; var result = [ ] ; if ( 'string' === typeof args ) { result = o ? [ args + ' ' + o ] : [ args ] ; } else if ( args instanceof Array ) { for ( var i = 0 ; i < args . length ; i ++ ) { if ( 'string' === typeof args [ i ] ) { o ? result . push ( args [ i ] + ' ' + o ) : result . push ( args [ i ] ) ; } else if ( 'object' === typeof args [ i ] ) { var key = Object . keys ( args [ i ] ) [ 0 ] ; result . push ( key + ' ' + args [ i ] [ key ] ) ; } } } else if ( args instanceof Object ) { var key = Object . keys ( args ) [ 0 ] ; result = [ key + ' ' + args [ key ] ] ; } return 'order by ' + result . join ( ) ; }
order by col1 asc, col2 desc ...
order by col1 asc col2 desc ...