Created
October 20, 2011 10:13
-
-
Save mashihua/1300821 to your computer and use it in GitHub Desktop.
get arguments
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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