diff options
Diffstat (limited to 'src/node_util.cc')
-rw-r--r-- | src/node_util.cc | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/node_util.cc b/src/node_util.cc index 180c58c416..0c498e2838 100644 --- a/src/node_util.cc +++ b/src/node_util.cc @@ -58,6 +58,16 @@ static void GetOwnNonIndexProperties( args.GetReturnValue().Set(properties); } +static void GetConstructorName( + const FunctionCallbackInfo<Value>& args) { + CHECK(args[0]->IsObject()); + + Local<Object> object = args[0].As<Object>(); + Local<String> name = object->GetConstructorName(); + + args.GetReturnValue().Set(name); +} + static void GetPromiseDetails(const FunctionCallbackInfo<Value>& args) { // Return undefined if it's not a Promise. if (!args[0]->IsPromise()) @@ -262,6 +272,7 @@ void Initialize(Local<Object> target, env->SetMethodNoSideEffect(target, "previewEntries", PreviewEntries); env->SetMethodNoSideEffect(target, "getOwnNonIndexProperties", GetOwnNonIndexProperties); + env->SetMethodNoSideEffect(target, "getConstructorName", GetConstructorName); env->SetMethod(target, "arrayBufferViewHasBuffer", ArrayBufferViewHasBuffer); Local<Object> constants = Object::New(env->isolate()); |