Missing typeof on the undefined check.  I guess this is not tested?