Simple JavaScript object type checker.