Last active
December 16, 2015 05:18
-
-
Save bodokaiser/5383105 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <v8.h> | |
#include <node.h> | |
inline Local<Value> ThrowTypeError(const char* message) { | |
HandleScope scope; | |
ThrowException(Exception::TypeError(String::New(message))); | |
return scope.Close(Undefined()); | |
}; | |
Handle<Value> SomeMethod(const Arguments &args) { | |
HandleScope scope: | |
if (!args[0]->IsObject() || args[0]->IsArray()) | |
return ThrowTypeError("Argument must be a object literal."); | |
return scope.Close(args[0]->ToObject()); | |
}; | |
NODE_MODULE(test, init); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment