is = function(_) { return(
  _ !== null && typeof(_) != "undefined"
)}


is.nt = function(_) { return(
  !is(_)
)}


$.each(is, function(i) {

  is.nt[i] = function(_) { return(
    !is[i](_)
  )}

})


is.bool = function(_) { return(
  typeof(_) == "boolean"
)}


is.num = function(_) { return(
  typeof(_) == "number"
)}


is.str = function(_) { return(
  typeof(_) == "string"
)}


is.re = function(_) { return(
  _ !== null && typeof(_) == "object" && is(_.test)
)}


is.singular = function(_) { return(
  is.bool(_) || is.num(_) || is.str(_) || is.re(_)
)}


is.args = function(_) { return(
  _ !== null && typeof(_) == "object" && is.nt(_.join)
)}


is.arr = function(_) { return(
  _ !== null && typeof(_) == "object" && is(_.join)
)}


is.obj = function(_) { return(
  _ !== null && typeof(_) == "object" && !(is(_.length) || is(_.test))
)}


is.fun = function(_) { return(
  typeof(_) == "function" && is.nt(_.test)
)}


is.plural = function(_) { return(
 is.arr(_) || is.args(_) || is.obj(_) || is.fun(_)
)}


is.event = function(_) { return(
  is.nt(_) || is(_.which || _.keyCode)
)}


$.each({
  bs:    8,
  tab:   9,
  enter: 13,
  esc:   27,
  space: 32,
  left:  37,
  up:    38,
  right: 39,
  down:  40
}, function(i, it) {

  $.is[i] = function(e) {
    return($.num(e) == it)
  }

})


$.each([
  "alt",
  "ctrl",
  "meta",
  "shift"
], function(i, it) {

  is[it] = function(e) {
    return(e[it+"Key"])
  }
 
})


is.of = function(_) {


  var types = [
    "nt",
    "num",
    "bool",
    "str",
    "re",
    "arr",
    "obj",
    "fun",
    "event" 
  ]

  var acc = []

  $.each(types, function(i, type) {
    if ($.is[type](_)) acc.push(_)
  })

  return(acc)

}