A much better implementation of isRawJSType().