In my implementation I provide a function to JavaScript that accepts a parameter.
v8::Handle<v8::Value> TableGetValueIdForValue(const v8::Arguments& args) {
v8::Isolate* isolate = v8::Isolate::GetCurrent();
v8::HandleScope handle_scope(isolate);
auto val = args[1];
if (val->IsNumber()) {
auto num = val->ToNumber();
// How to check if Int or Double
} else {
// val == string
}
}
Now this parameter can have basically any type. As I support Int, Float and String I want to efficiently check for these types. Using IsNumber()
and IsStringObject()
I can make sure that the objects are numberish or a string.
But now I need to differentiate between an integer value and a float. What is the best way to perform this test? Is there a way to call / use the typeof
function exposed to JS?