good enough javascript type checking