lib/Pipeline.js
function injectDependencies(func, args, callback ){
    
    var declaredArguments = toolbox.parseDeclaredArguments(func);
    declaredArguments = declaredArguments.replace(/\s+/g, "").split(",");
    logger.trace("injectDependencies() declaredArguments: ", declaredArguments, "provided args:", args);
    var useCallback = false;
    var len = args.length > declaredArguments.length? args.length:declaredArguments.length;
    for(var i=0;i< len ;i++){ // this is problematic: functions may be wrapped and lost the arguments data
        /** if client did not provide enough number of arguments, we fill it with null*/
        if(typeof( args[i]) == 'undefined')
            args[i] = undefined;
        else if(args[i] === "$callback"){
            useCallback = true;    
            args[i] = callback;        
        }
        switch(declaredArguments[i]){
            case '$callback':
                logger.debug("Injecting callback handler");
                args[i] = callback;
                useCallback = true;
                break;
             case '$context':
                logger.debug("Injecting angoose context");
                args[i] = angoose().getContext();
                break;
             default:
                break; 
        } 
    } 
    return useCallback;
}
function injectDependencies(func, args, callback ){
    
    var declaredArguments = toolbox.parseDeclaredArguments(func);
    declaredArguments = declaredArguments.replace(/\s+/g, "").split(",");
    logger.trace("injectDependencies() declaredArguments: ", declaredArguments, "provided args:", args);
    var useCallback = false;
    var len = args.length > declaredArguments.length? args.length:declaredArguments.length;
    for(var i=0;i< len ;i++){ // this is problematic: functions may be wrapped and lost the arguments data
        /** if client did not provide enough number of arguments, we fill it with null*/
        if(typeof( args[i]) == 'undefined')
            args[i] = undefined;
        else if(args[i] === "$callback"){
            useCallback = true;    
            args[i] = callback;        
        }
        switch(declaredArguments[i]){
            case '$callback':
                logger.debug("Injecting callback handler");
                args[i] = callback;
                useCallback = true;
                break;
             case '$context':
                logger.debug("Injecting angoose context");
                args[i] = angoose().getContext();
                break;
             default:
                break; 
        } 
    } 
    return useCallback;
}
hookIt('authorize', proto.authorize);