Strip Arguments
by smasala
JavaScript
var stripArguments = function(args){
if ($.isPlainObject(args) && $.isNumeric(args.length) && args.hasOwnProperty("callee")) {
//convert the argument wrapped arguments "array" back to a single "array"
if (args.length) {
args = args[0];
}
}
return args;
}
/******************************************/
var a = function(){
//arguments are [["a", "b", "c"]]
return stripArguments(arguments) //return ["a", "b", "c"]
}
var b = function(){
return a(arguments); //note not called with apply
}
console.info(b("a", "b", "c"))