Skip to content

Commit

Permalink
simplify sending
Browse files Browse the repository at this point in the history
  • Loading branch information
Nick Desaulniers committed Mar 26, 2015
1 parent 6b6cfb0 commit a67941a
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/node_nanomsg.cc
Original file line number Diff line number Diff line change
Expand Up @@ -203,15 +203,11 @@ NAN_METHOD(Send) {
const char* data = NULL;
size_t length = 0;

// check if Local<v8::Value> is a v8::String
if (args[1]->IsString()) {
// check if first arg is a v8::String or a buffer
if (args[1]->IsString() || node::Buffer::HasInstance(args[1])) {
utf8 s (args[1]);
data = *s;
length = s.length();
} else if (node::Buffer::HasInstance(args[1])) {
// check if the v8::Object is a buffer
data = node::Buffer::Data(args[1]);
length = node::Buffer::Length(args[1]);
} else {
NanReturnUndefined();
}
Expand Down

0 comments on commit a67941a

Please sign in to comment.