Skip to content

Instantly share code, notes, and snippets.

@kflorence
Forked from rkatic/isArguments.js
Created May 2, 2011 22:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kflorence/952521 to your computer and use it in GitHub Desktop.
Save kflorence/952521 to your computer and use it in GitHub Desktop.
isArguments
var isArguments = (function( undefined ) {
var toString = Object.prototype.toString,
returnTrue = function() {
return arguments !== undefined;
};
return function( obj ) {
if ( obj != null ) {
if ( toString.call( obj ) == "[object Arguments]" ) {
return true;
} else if ( "callee" in obj ) {
try {
return returnTrue.apply( this, obj );
} catch ( e ) {}
}
}
return false;
}
})();
@kflorence
Copy link
Author

Yeah, I should be strict mode compliant. Also I was happy to see [object Null] and [object Undefined] in FF 4.0, that could be helpful.

@rkatic
Copy link

rkatic commented May 2, 2011

Yea, seams I was wrong on that. Hope other browsers are same...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment