diff --git a/README.md b/README.md
index 7167ae34..3c474e02 100644
--- a/README.md
+++ b/README.md
@@ -157,6 +157,7 @@ The `Nan::MaybeLocal` and `Nan::Maybe` types are monads that encapsulate `v8::Lo
- Nan::Nothing
- Nan::Just
* **Maybe Helpers**
+ - Nan::Call()
- Nan::ToDetailString()
- Nan::ToArrayIndex()
- Nan::Equals()
@@ -277,7 +278,7 @@ The hooks to access V8 internals—including GC and statistics—are different a
- Nan::GetCurrentContext()
- Nan::SetIsolateData()
- Nan::GetIsolateData()
- - Nan::TypedArrayContents
+ - Nan::TypedArrayContents
### Miscellaneous Node Helpers
diff --git a/doc/maybe_types.md b/doc/maybe_types.md
index d2e5b7df..9ca9ceec 100644
--- a/doc/maybe_types.md
+++ b/doc/maybe_types.md
@@ -8,6 +8,7 @@ The `Nan::MaybeLocal` and `Nan::Maybe` types are monads that encapsulate `v8::Lo
- Nan::Nothing
- Nan::Just
* **Maybe Helpers**
+ - Nan::Call()
- Nan::ToDetailString()
- Nan::ToArrayIndex()
- Nan::Equals()
@@ -113,6 +114,17 @@ Construct a `Nan::Maybe` type representing _just_ a value.
template Nan::Maybe Nan::Just(const T &t);
```
+
+### Nan::Call()
+
+A helper method for calling [`v8::Function#Call()`](https://v8docs.nodesource.com/io.js-3.0/d5/d54/classv8_1_1_function.html#a468a89f737af0612db10132799c827c0) in a way compatible across supported versions of V8.
+
+Signature:
+
+```c++
+Nan::MaybeLocal Nan::Call(v8::Local fun, v8::Local recv, int argc, v8::Local argv[]);
+```
+
### Nan::ToDetailString()
diff --git a/nan_maybe_43_inl.h b/nan_maybe_43_inl.h
index e06c8d2f..2d17f69a 100644
--- a/nan_maybe_43_inl.h
+++ b/nan_maybe_43_inl.h
@@ -221,4 +221,12 @@ NAN_INLINE MaybeLocal CloneElementAt(
return array->CloneElementAt(GetCurrentContext(), index);
}
+NAN_INLINE MaybeLocal Call(
+ v8::Local fun
+ , v8::Local recv
+ , int argc
+ , v8::Local argv[]) {
+ return fun->Call(GetCurrentContext(), recv, argc, argv);
+}
+
#endif // NAN_MAYBE_43_INL_H_
diff --git a/nan_maybe_pre_43_inl.h b/nan_maybe_pre_43_inl.h
index 0857347b..03b94b64 100644
--- a/nan_maybe_pre_43_inl.h
+++ b/nan_maybe_pre_43_inl.h
@@ -292,4 +292,12 @@ NAN_INLINE MaybeLocal CloneElementAt(
return MaybeLocal(array->CloneElementAt(index));
}
+NAN_INLINE MaybeLocal Call(
+ v8::Local fun
+ , v8::Local recv
+ , int argc
+ , v8::Local argv[]) {
+ return MaybeLocal(fun->Call(recv, argc, argv));
+}
+
#endif // NAN_MAYBE_PRE_43_INL_H_