changed instanceof to typeof
0.5.2