-
-
Save kflorence/952521 to your computer and use it in GitHub Desktop.
isArguments
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
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; | |
} | |
})(); |
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
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.