bin/amigo.js
function _extract(req, param){

    var ret = [];

    // Note: no route parameter possible with lists(?).

    // Try the get space.
    if( req && req.query && typeof(req.query[param]) !== 'undefined' ){
	//console.log('as query');

	// Input as list, remove dupes.
	var paccs = req.query[param];
	if( paccs && ! us.isArray(paccs) ){
	    paccs = [paccs];
	}
	ret = us.uniq(paccs);
    }

    // Otherwise, try the body space.
    if( us.isEmpty(ret) ){

	var decoded_body = req.body || {};
	if( decoded_body && ! us.isEmpty(decoded_body) && decoded_body[param] ){
	    //console.log('as body');

	    // Input as list, remove dupes.
	    var baccs = decoded_body[param];
	    //console.log('decoded_body', decoded_body);
	    //console.log('baccs', baccs);
	    if( baccs && ! us.isArray(baccs) ){
		baccs = [baccs];
	    }
	    ret = us.uniq(baccs);
	}
    }

    return ret;
}
function _extract(req, param){

    var ret = [];

    // Note: no route parameter possible with lists(?).

    // Try the get space.
    if( req && req.query && typeof(req.query[param]) !== 'undefined' ){
	//console.log('as query');

	// Input as list, remove dupes.
	var paccs = req.query[param];
	if( paccs && ! us.isArray(paccs) ){
	    paccs = [paccs];
	}
	ret = us.uniq(paccs);
    }

    // Otherwise, try the body space.
    if( us.isEmpty(ret) ){

	var decoded_body = req.body || {};
	if( decoded_body && ! us.isEmpty(decoded_body) && decoded_body[param] ){
	    //console.log('as body');

	    // Input as list, remove dupes.
	    var baccs = decoded_body[param];
	    //console.log('decoded_body', decoded_body);
	    //console.log('baccs', baccs);
	    if( baccs && ! us.isArray(baccs) ){
		baccs = [baccs];
	    }
	    ret = us.uniq(baccs);
	}
    }

    return ret;
}
function _extract ( req , param ) { var ret = [ ] ; // Note: no route parameter possible with lists(?). // Try the get space. if ( req && req . query && typeof ( req . query [ param ] ) !== 'undefined' ) { //console.log('as query'); // Input as list, remove dupes. var paccs = req . query [ param ] ; if ( paccs && ! us . isArray ( paccs ) ) { paccs = [ paccs ] ; } ret = us . uniq ( paccs ) ; } // Otherwise, try the body space. if ( us . isEmpty ( ret ) ) { var decoded_body = req . body || { } ; if ( decoded_body && ! us . isEmpty ( decoded_body ) && decoded_body [ param ] ) { //console.log('as body'); // Input as list, remove dupes. var baccs = decoded_body [ param ] ; //console.log('decoded_body', decoded_body); //console.log('baccs', baccs); if ( baccs && ! us . isArray ( baccs ) ) { baccs = [ baccs ] ; } ret = us . uniq ( baccs ) ; } } return ret ; }
Extract list arguments.
Extract list arguments .