Skip to content

Instantly share code, notes, and snippets.

@pocotan001
Created May 18, 2013 17:28
Show Gist options
  • Save pocotan001/5605202 to your computer and use it in GitHub Desktop.
Save pocotan001/5605202 to your computer and use it in GitHub Desktop.
is.js
/**
* @param {String} type [http://goo.gl/B5k5w]
* @param {Mix} object
* @return {Boolean}
*/
function is(type, object) {
var klass = Object.prototype.toString.call(object).slice(8, -1);
return object !== undefined && object !== null && klass === type;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment