Personally I use a “prepare arguments” function in all my code. Put simply, it allows me to call a function with either the normal arguments or with an object containing them all, ie:

myFunction(varA, varB, varC) OR myFunction({varA: 5, varB: 6, varC: 7})

I find this to be very useful on functions that end up having a dozen arguments or whatnot. Each function simply has a call to the prepArgs function:

var A = prepArgs(arguments, [‘ns’, ‘ex’, ‘r’, ‘p’, ‘x’], [‘ns’], _, ‘load’);if(!A) return;

this has the list of variables (ns, ex, …), the required variables (ns), arguments that must be arrays and the function name it came from (used for throwing an error). Arguments are then accessed with A.ns, etc instead of just “ns”

function if anyone is interested, needs to be modified to work outside of my framework:

function prepArgs(){
var args = arguments[0];
var nams = arguments[1];
var reqs = arguments[2];
var arys = arguments[3];
var calf = arguments[4];

if(args[0] && args[0].callee) return prepArgs(args[0]);

var result = [], n, aN=isArray(nams);

if(args[0] && args[0][0] && (args[0][0]===JSLibrary._$)){
for(n in args[0][1]){
result[n] = args[0][1][n];
}
if(aN){
for(var i=nams.length-1; i>=0; i–){
result[i] = result[names[i]];
}
}
}else if(aN){
for(var i=nams.length-1; i>=0; i–){
result[nams[i]] = result[i] = args[i];
}
}else{
for(var i=0; i=0; i–){
if(!result[reqs[i]]){
if(calf) throwError(JSLibrary.missingArgs.supplant({f: calf}));
return false;
}
}
}
if(arys){
for(var i=arys.length-1; i>=0; i–){
result[arys[i]] = $A[result[arys[i]]];
}
}

return result;
}