better-sqlite3
Advanced tools
+1
-1
| { | ||
| "name": "better-sqlite3", | ||
| "version": "13.0.0", | ||
| "version": "13.0.1", | ||
| "description": "The fastest and simplest library for SQLite in Node.js.", | ||
@@ -5,0 +5,0 @@ "homepage": "http://github.com/WiseLibs/better-sqlite3", |
+10
-6
@@ -44,6 +44,9 @@ class Binder { | ||
| // An object is "plain" if its prototype is null or Object.prototype. Unlike | ||
| // the original V8 implementation, we cannot look up Object.prototype within | ||
| // the object's creation context (Node-API has no such concept), so plain | ||
| // objects from other contexts (e.g., the "vm" module) are not recognized. | ||
| // An object is "plain" if its prototype is null or a top-level prototype | ||
| // (i.e., some realm's Object.prototype). Rather than comparing against the | ||
| // current realm's Object.prototype -- which would reject plain objects from | ||
| // other contexts, such as the "vm" module -- we walk to the top of the | ||
| // prototype chain. A plain object's chain is exactly "obj -> proto -> null", | ||
| // so its immediate prototype must itself have a null prototype. This mirrors | ||
| // the cross-realm heuristic used by lodash's isPlainObject. | ||
| static bool IsPlainObject(Napi::Env env, Napi::Object obj) { | ||
@@ -53,4 +56,5 @@ Napi::Value proto = GetPrototype(env, obj); | ||
| if (proto.IsNull()) return true; | ||
| Napi::Value baseProto = GetPrototype(env, Napi::Object::New(env)); | ||
| return !baseProto.IsEmpty() && proto.StrictEquals(baseProto); | ||
| Napi::Value grandproto = GetPrototype(env, proto.As<Napi::Object>()); | ||
| if (grandproto.IsEmpty()) return false; | ||
| return grandproto.IsNull(); | ||
| } | ||
@@ -57,0 +61,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
27311318
0