Skip to content

Commit

Permalink
fixed IsPlainObject
Browse files Browse the repository at this point in the history
  • Loading branch information
Joshua Wise committed Sep 1, 2016
1 parent d819cea commit 5c40df9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions TODO
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ Polish the changes/last_row_id API of .run()

reduce the number of memory copies

optimize binding by creating bind maps when statements and transactions are
created. This way, we can eliminate overhead caused by the NextAnonIndex()
and GetNamedParameterIndex() functions

if we promisify run(), get(), all(), or each(), their performance will suffer
if more than 3 arguments are passed (more than 2 bound arguments for each())

Expand Down
3 changes: 3 additions & 0 deletions src/binder/is-plain-object.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

bool Binder::IsPlainObject(v8::Local<v8::Object> obj) {
v8::Local<v8::Value> proto = obj->GetPrototype();
v8::Local<v8::Context> ctx = obj->CreationContext();
ctx->Enter();
v8::Local<v8::Value> baseProto = Nan::New<v8::Object>()->GetPrototype();
ctx->Exit();
return proto->StrictEquals(baseProto) || proto->StrictEquals(Nan::Null());
}

0 comments on commit 5c40df9

Please sign in to comment.