Created
August 23, 2016 00:52
-
-
Save rexfordkelly/2b5f61327c73735d1ca9f653eb6f8329 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 q = (function () { | |
return 'Array,Boolean,Date,Function,Null,Number,Object,RegExp,String,Undefined'.split(',').reduce( function( checker, type ){ | |
checker['is' + type] = ( function (identity){ | |
return function (context) { | |
return Object.prototype.toString.call(context).slice(8, -1) === identity; | |
}; | |
})( type ); | |
return checker; | |
}, {}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment