JavaScripts typeof operator is insane. Sane typeof is not. Check your objects with sane typeof and compare the result to a lowercase string with your expected type.