lib/core.js
function(qargs){

	var mbuff = [];
	for( var qname in qargs ){
	    var qval = qargs[qname];

	    // null is technically an object, but we don't want to render
	    // it.
	    if( qval != null ){
		if( typeof qval == 'string' || typeof qval == 'number' ){
		    // Is standard name/value pair.
		    var nano_buffer = [];
		    nano_buffer.push(qname);
		    nano_buffer.push('=');
		    nano_buffer.push(qval);
		    mbuff.push(nano_buffer.join(''));
		}else if( typeof qval == 'object' ){
		    if( typeof qval.length != 'undefined' ){
			// Is array (probably).
			// Iterate through and double on.
			for(var qval_i = 0; qval_i < qval.length ; qval_i++){
			    var nano_buff = [];
			    nano_buff.push(qname);
			    nano_buff.push('=');
			    nano_buff.push(qval[qval_i]);
			    mbuff.push(nano_buff.join(''));
			}
		    }else{
			// // TODO: The "and" case is pretty much like
			// // the array, the "or" case needs to be
			// // handled carefully. In both cases, care will
			// // be needed to show which filters are marked.
			// Is object (probably).
			// Special "Solr-esque" handling.
			for( var sub_name in qval ){
			    var sub_vals = qval[sub_name];
			    
			    // Since there might be an array down there,
			    // ensure that there is an iterate over it.
			    if( _what_is(sub_vals) != 'array' ){
				sub_vals = [sub_vals];
			    }
			    
			    each(sub_vals, function(sub_val){
				var nano_buff = [];
				nano_buff.push(qname);
				nano_buff.push('=');
				nano_buff.push(sub_name);
				nano_buff.push(':');
				if( typeof sub_val !== 'undefined' && sub_val ){
				    // Do not double quote strings.
				    // Also, do not requote if we already
				    // have parens in place--that
				    // indicates a complicated
				    // expression. See the unit tests.
				    var val_is_a = _what_is(sub_val);
				    if( val_is_a == 'string' &&
					sub_val.charAt(0) == '"' &&
					sub_val.charAt(sub_val.length -1) == '"' ){
					    nano_buff.push(sub_val);
					}else if( val_is_a == 'string' &&
						  sub_val.charAt(0) == '(' &&
						  sub_val.charAt(sub_val.length -1) == ')' ){
						      nano_buff.push(sub_val);
						  }else{
						      nano_buff.push('"' + sub_val + '"');
						  }
				}else{
				    nano_buff.push('""');
				}
				mbuff.push(nano_buff.join(''));
			    });
			}
		    }
		}else if( typeof qval == 'undefined' ){
		    // This happens in some cases where a key is tried, but no
		    // value is found--likely equivalent to q="", but we'll
		    // let it drop.
		    // var nano_buff = [];
		    // nano_buff.push(qname);
		    // nano_buff.push('=');
		    // mbuff.push(nano_buff.join(''));	    
		}else{
		    throw new Error("bbop.core.get_assemble: unknown type: " + 
				    typeof(qval));
		}
	    }
	}
	
	return mbuff.join('&');
    }
function(qargs){

	var mbuff = [];
	for( var qname in qargs ){
	    var qval = qargs[qname];

	    // null is technically an object, but we don't want to render
	    // it.
	    if( qval != null ){
		if( typeof qval == 'string' || typeof qval == 'number' ){
		    // Is standard name/value pair.
		    var nano_buffer = [];
		    nano_buffer.push(qname);
		    nano_buffer.push('=');
		    nano_buffer.push(qval);
		    mbuff.push(nano_buffer.join(''));
		}else if( typeof qval == 'object' ){
		    if( typeof qval.length != 'undefined' ){
			// Is array (probably).
			// Iterate through and double on.
			for(var qval_i = 0; qval_i < qval.length ; qval_i++){
			    var nano_buff = [];
			    nano_buff.push(qname);
			    nano_buff.push('=');
			    nano_buff.push(qval[qval_i]);
			    mbuff.push(nano_buff.join(''));
			}
		    }else{
			// // TODO: The "and" case is pretty much like
			// // the array, the "or" case needs to be
			// // handled carefully. In both cases, care will
			// // be needed to show which filters are marked.
			// Is object (probably).
			// Special "Solr-esque" handling.
			for( var sub_name in qval ){
			    var sub_vals = qval[sub_name];
			    
			    // Since there might be an array down there,
			    // ensure that there is an iterate over it.
			    if( _what_is(sub_vals) != 'array' ){
				sub_vals = [sub_vals];
			    }
			    
			    each(sub_vals, function(sub_val){
				var nano_buff = [];
				nano_buff.push(qname);
				nano_buff.push('=');
				nano_buff.push(sub_name);
				nano_buff.push(':');
				if( typeof sub_val !== 'undefined' && sub_val ){
				    // Do not double quote strings.
				    // Also, do not requote if we already
				    // have parens in place--that
				    // indicates a complicated
				    // expression. See the unit tests.
				    var val_is_a = _what_is(sub_val);
				    if( val_is_a == 'string' &&
					sub_val.charAt(0) == '"' &&
					sub_val.charAt(sub_val.length -1) == '"' ){
					    nano_buff.push(sub_val);
					}else if( val_is_a == 'string' &&
						  sub_val.charAt(0) == '(' &&
						  sub_val.charAt(sub_val.length -1) == ')' ){
						      nano_buff.push(sub_val);
						  }else{
						      nano_buff.push('"' + sub_val + '"');
						  }
				}else{
				    nano_buff.push('""');
				}
				mbuff.push(nano_buff.join(''));
			    });
			}
		    }
		}else if( typeof qval == 'undefined' ){
		    // This happens in some cases where a key is tried, but no
		    // value is found--likely equivalent to q="", but we'll
		    // let it drop.
		    // var nano_buff = [];
		    // nano_buff.push(qname);
		    // nano_buff.push('=');
		    // mbuff.push(nano_buff.join(''));	    
		}else{
		    throw new Error("bbop.core.get_assemble: unknown type: " + 
				    typeof(qval));
		}
	    }
	}
	
	return mbuff.join('&');
    }
function ( qargs ) { var mbuff = [ ] ; for ( var qname in qargs ) { var qval = qargs [ qname ] ; // null is technically an object, but we don't want to render // it. if ( qval != null ) { if ( typeof qval == 'string' || typeof qval == 'number' ) { // Is standard name/value pair. var nano_buffer = [ ] ; nano_buffer . push ( qname ) ; nano_buffer . push ( '=' ) ; nano_buffer . push ( qval ) ; mbuff . push ( nano_buffer . join ( '' ) ) ; } else if ( typeof qval == 'object' ) { if ( typeof qval . length != 'undefined' ) { // Is array (probably). // Iterate through and double on. for ( var qval_i = 0 ; qval_i < qval . length ; qval_i ++ ) { var nano_buff = [ ] ; nano_buff . push ( qname ) ; nano_buff . push ( '=' ) ; nano_buff . push ( qval [ qval_i ] ) ; mbuff . push ( nano_buff . join ( '' ) ) ; } } else { // // TODO: The "and" case is pretty much like // // the array, the "or" case needs to be // // handled carefully. In both cases, care will // // be needed to show which filters are marked. // Is object (probably). // Special "Solr-esque" handling. for ( var sub_name in qval ) { var sub_vals = qval [ sub_name ] ; // Since there might be an array down there, // ensure that there is an iterate over it. if ( _what_is ( sub_vals ) != 'array' ) { sub_vals = [ sub_vals ] ; } each ( sub_vals , function ( sub_val ) { var nano_buff = [ ] ; nano_buff . push ( qname ) ; nano_buff . push ( '=' ) ; nano_buff . push ( sub_name ) ; nano_buff . push ( ':' ) ; if ( typeof sub_val !== 'undefined' && sub_val ) { // Do not double quote strings. // Also, do not requote if we already // have parens in place--that // indicates a complicated // expression. See the unit tests. var val_is_a = _what_is ( sub_val ) ; if ( val_is_a == 'string' && sub_val . charAt ( 0 ) == '"' && sub_val . charAt ( sub_val . length - 1 ) == '"' ) { nano_buff . push ( sub_val ) ; } else if ( val_is_a == 'string' && sub_val . charAt ( 0 ) == '(' && sub_val . charAt ( sub_val . length - 1 ) == ')' ) { nano_buff . push ( sub_val ) ; } else { nano_buff . push ( '"' + sub_val + '"' ) ; } } else { nano_buff . push ( '""' ) ; } mbuff . push ( nano_buff . join ( '' ) ) ; } ) ; } } } else if ( typeof qval == 'undefined' ) { // This happens in some cases where a key is tried, but no // value is found--likely equivalent to q="", but we'll // let it drop. // var nano_buff = []; // nano_buff.push(qname); // nano_buff.push('='); // mbuff.push(nano_buff.join(''));	     } else { throw new Error ( "bbop.core.get_assemble: unknown type: " + typeof ( qval ) ) ; } } } return mbuff . join ( '&' ) ; }
Assemble an object into a GET-like query. You probably want to see
the tests to get an idea of what this is doing.

The last argument of double hashes gets quoted (Solr-esque),
otherwise not. It will try and avoid adding additional sets of
quotes to strings.

This does nothing to make the produced "URL" in any way safe.

WARNING: Not a hugely clean function--there are a lot of special
cases and it could use a good (and safe) clean-up.

@param {} qargs - hash/object
@returns {string} string
Assemble an object into a GET - like query . You probably want to see the tests to get an idea of what this is doing .