-
-
Save stdclass/977050 to your computer and use it in GitHub Desktop.
Type Checking
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 is={}; | |
(function(t,c,i,e,o){c=function(o){return function(v){return o==v.constructor;}};t=t.split(",");i=0;while(e=t[i++])this[e]=c(eval(e))}) | |
.call(is, "String,Array,Object,Function,Number"); | |
console.log( is.String( "123" ) ); // true | |
console.log( is.String( 123 ) ); // false | |
console.log( is.Number( 123) ); // true | |
console.log( is.Object( {} ) ); // true |
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(t,c,i,e,o){c=function(o){return function(v){return o==v.constructor;}};t=t.split(",");i=0;while(e=t[i++])this[e]=c(eval(e))}) |
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
{ | |
"name": "typechecking", | |
"keywords": [ "check", "type", "checktype" ] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment