| 126 | // db.exec.call(stmt)) would reinterpret the wrapped pointer as the wrong type. |
| 127 | template <typename T, Napi::Value (*method)(const Napi::CallbackInfo&)> |
| 128 | napi_value TypeSafeCallback(napi_env env, napi_callback_info info) { |
| 129 | Napi::CallbackInfo cbinfo(env, info); |
| 130 | if (!IsInstanceOf<T>(env, cbinfo.This())) { |
| 131 | Napi::TypeError::New(env, "Illegal invocation").ThrowAsJavaScriptException(); |
| 132 | return NULL; |
| 133 | } |
| 134 | return method(cbinfo); |
| 135 | } |
| 136 | |
| 137 | // These match the default attributes of properties created by a V8 template. |
| 138 | constexpr napi_property_attributes DEFAULT_ATTRIBUTES = |
nothing calls this directly
no outgoing calls
no test coverage detected