Skip to content

Instantly share code, notes, and snippets.

@mashihua
Created October 20, 2011 10:13
Show Gist options
  • Save mashihua/1300821 to your computer and use it in GitHub Desktop.
Save mashihua/1300821 to your computer and use it in GitHub Desktop.
get arguments
function arg(type) {
var r,t = Object.prototype.toString;
[].forEach.call(arguments.callee.caller.arguments, function (a) {
if (!r && t.call(arguments[0]).replace(/^[^\s]+\s([^\]]+)]/ig,"$1").toLowerCase() === type.toLowerCase()) r = a;
});
return r;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment