Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

maybe_types.md 22KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583
  1. ## Maybe Types
  2. The `Nan::MaybeLocal` and `Nan::Maybe` types are monads that encapsulate `v8::Local` handles that _may be empty_.
  3. * **Maybe Types**
  4. - <a href="#api_nan_maybe_local"><b><code>Nan::MaybeLocal</code></b></a>
  5. - <a href="#api_nan_maybe"><b><code>Nan::Maybe</code></b></a>
  6. - <a href="#api_nan_nothing"><b><code>Nan::Nothing</code></b></a>
  7. - <a href="#api_nan_just"><b><code>Nan::Just</code></b></a>
  8. * **Maybe Helpers**
  9. - <a href="#api_nan_call"><b><code>Nan::Call()</code></b></a>
  10. - <a href="#api_nan_to_detail_string"><b><code>Nan::ToDetailString()</code></b></a>
  11. - <a href="#api_nan_to_array_index"><b><code>Nan::ToArrayIndex()</code></b></a>
  12. - <a href="#api_nan_equals"><b><code>Nan::Equals()</code></b></a>
  13. - <a href="#api_nan_new_instance"><b><code>Nan::NewInstance()</code></b></a>
  14. - <a href="#api_nan_get_function"><b><code>Nan::GetFunction()</code></b></a>
  15. - <a href="#api_nan_set"><b><code>Nan::Set()</code></b></a>
  16. - <a href="#api_nan_define_own_property"><b><code>Nan::DefineOwnProperty()</code></b></a>
  17. - <a href="#api_nan_force_set"><del><b><code>Nan::ForceSet()</code></b></del></a>
  18. - <a href="#api_nan_get"><b><code>Nan::Get()</code></b></a>
  19. - <a href="#api_nan_get_property_attribute"><b><code>Nan::GetPropertyAttributes()</code></b></a>
  20. - <a href="#api_nan_has"><b><code>Nan::Has()</code></b></a>
  21. - <a href="#api_nan_delete"><b><code>Nan::Delete()</code></b></a>
  22. - <a href="#api_nan_get_property_names"><b><code>Nan::GetPropertyNames()</code></b></a>
  23. - <a href="#api_nan_get_own_property_names"><b><code>Nan::GetOwnPropertyNames()</code></b></a>
  24. - <a href="#api_nan_set_prototype"><b><code>Nan::SetPrototype()</code></b></a>
  25. - <a href="#api_nan_object_proto_to_string"><b><code>Nan::ObjectProtoToString()</code></b></a>
  26. - <a href="#api_nan_has_own_property"><b><code>Nan::HasOwnProperty()</code></b></a>
  27. - <a href="#api_nan_has_real_named_property"><b><code>Nan::HasRealNamedProperty()</code></b></a>
  28. - <a href="#api_nan_has_real_indexed_property"><b><code>Nan::HasRealIndexedProperty()</code></b></a>
  29. - <a href="#api_nan_has_real_named_callback_property"><b><code>Nan::HasRealNamedCallbackProperty()</code></b></a>
  30. - <a href="#api_nan_get_real_named_property_in_prototype_chain"><b><code>Nan::GetRealNamedPropertyInPrototypeChain()</code></b></a>
  31. - <a href="#api_nan_get_real_named_property"><b><code>Nan::GetRealNamedProperty()</code></b></a>
  32. - <a href="#api_nan_call_as_function"><b><code>Nan::CallAsFunction()</code></b></a>
  33. - <a href="#api_nan_call_as_constructor"><b><code>Nan::CallAsConstructor()</code></b></a>
  34. - <a href="#api_nan_get_source_line"><b><code>Nan::GetSourceLine()</code></b></a>
  35. - <a href="#api_nan_get_line_number"><b><code>Nan::GetLineNumber()</code></b></a>
  36. - <a href="#api_nan_get_start_column"><b><code>Nan::GetStartColumn()</code></b></a>
  37. - <a href="#api_nan_get_end_column"><b><code>Nan::GetEndColumn()</code></b></a>
  38. - <a href="#api_nan_clone_element_at"><b><code>Nan::CloneElementAt()</code></b></a>
  39. - <a href="#api_nan_has_private"><b><code>Nan::HasPrivate()</code></b></a>
  40. - <a href="#api_nan_get_private"><b><code>Nan::GetPrivate()</code></b></a>
  41. - <a href="#api_nan_set_private"><b><code>Nan::SetPrivate()</code></b></a>
  42. - <a href="#api_nan_delete_private"><b><code>Nan::DeletePrivate()</code></b></a>
  43. - <a href="#api_nan_make_maybe"><b><code>Nan::MakeMaybe()</code></b></a>
  44. <a name="api_nan_maybe_local"></a>
  45. ### Nan::MaybeLocal
  46. A `Nan::MaybeLocal<T>` is a wrapper around [`v8::Local<T>`](https://v8docs.nodesource.com/node-8.11/de/deb/classv8_1_1_local.html) that enforces a check that determines whether the `v8::Local<T>` is empty before it can be used.
  47. If an API method returns a `Nan::MaybeLocal`, the API method can potentially fail either because an exception is thrown, or because an exception is pending, e.g. because a previous API call threw an exception that hasn't been caught yet, or because a `v8::TerminateExecution` exception was thrown. In that case, an empty `Nan::MaybeLocal` is returned.
  48. Definition:
  49. ```c++
  50. template<typename T> class Nan::MaybeLocal {
  51. public:
  52. MaybeLocal();
  53. template<typename S> MaybeLocal(v8::Local<S> that);
  54. bool IsEmpty() const;
  55. template<typename S> bool ToLocal(v8::Local<S> *out);
  56. // Will crash if the MaybeLocal<> is empty.
  57. v8::Local<T> ToLocalChecked();
  58. template<typename S> v8::Local<S> FromMaybe(v8::Local<S> default_value) const;
  59. };
  60. ```
  61. See the documentation for [`v8::MaybeLocal`](https://v8docs.nodesource.com/node-8.11/d8/d7d/classv8_1_1_maybe_local.html) for further details.
  62. <a name="api_nan_maybe"></a>
  63. ### Nan::Maybe
  64. A simple `Nan::Maybe` type, representing an object which may or may not have a value, see https://hackage.haskell.org/package/base/docs/Data-Maybe.html.
  65. If an API method returns a `Nan::Maybe<>`, the API method can potentially fail either because an exception is thrown, or because an exception is pending, e.g. because a previous API call threw an exception that hasn't been caught yet, or because a `v8::TerminateExecution` exception was thrown. In that case, a "Nothing" value is returned.
  66. Definition:
  67. ```c++
  68. template<typename T> class Nan::Maybe {
  69. public:
  70. bool IsNothing() const;
  71. bool IsJust() const;
  72. // Will crash if the Maybe<> is nothing.
  73. T FromJust();
  74. T FromMaybe(const T& default_value);
  75. bool operator==(const Maybe &other);
  76. bool operator!=(const Maybe &other);
  77. };
  78. ```
  79. See the documentation for [`v8::Maybe`](https://v8docs.nodesource.com/node-8.11/d9/d4b/classv8_1_1_maybe.html) for further details.
  80. <a name="api_nan_nothing"></a>
  81. ### Nan::Nothing
  82. Construct an empty `Nan::Maybe` type representing _nothing_.
  83. ```c++
  84. template<typename T> Nan::Maybe<T> Nan::Nothing();
  85. ```
  86. <a name="api_nan_just"></a>
  87. ### Nan::Just
  88. Construct a `Nan::Maybe` type representing _just_ a value.
  89. ```c++
  90. template<typename T> Nan::Maybe<T> Nan::Just(const T &t);
  91. ```
  92. <a name="api_nan_call"></a>
  93. ### Nan::Call()
  94. A helper method for calling a synchronous [`v8::Function#Call()`](https://v8docs.nodesource.com/node-8.11/d5/d54/classv8_1_1_function.html#a9c3d0e4e13ddd7721fce238aa5b94a11) in a way compatible across supported versions of V8.
  95. For asynchronous callbacks, use Nan::Callback::Call along with an AsyncResource.
  96. Signature:
  97. ```c++
  98. Nan::MaybeLocal<v8::Value> Nan::Call(v8::Local<v8::Function> fun, v8::Local<v8::Object> recv, int argc, v8::Local<v8::Value> argv[]);
  99. Nan::MaybeLocal<v8::Value> Nan::Call(const Nan::Callback& callback, v8::Local<v8::Object> recv,
  100. int argc, v8::Local<v8::Value> argv[]);
  101. Nan::MaybeLocal<v8::Value> Nan::Call(const Nan::Callback& callback, int argc, v8::Local<v8::Value> argv[]);
  102. ```
  103. <a name="api_nan_to_detail_string"></a>
  104. ### Nan::ToDetailString()
  105. A helper method for calling [`v8::Value#ToDetailString()`](https://v8docs.nodesource.com/node-8.11/dc/d0a/classv8_1_1_value.html#a2f9770296dc2c8d274bc8cc0dca243e5) in a way compatible across supported versions of V8.
  106. Signature:
  107. ```c++
  108. Nan::MaybeLocal<v8::String> Nan::ToDetailString(v8::Local<v8::Value> val);
  109. ```
  110. <a name="api_nan_to_array_index"></a>
  111. ### Nan::ToArrayIndex()
  112. A helper method for calling [`v8::Value#ToArrayIndex()`](https://v8docs.nodesource.com/node-8.11/dc/d0a/classv8_1_1_value.html#acc5bbef3c805ec458470c0fcd6f13493) in a way compatible across supported versions of V8.
  113. Signature:
  114. ```c++
  115. Nan::MaybeLocal<v8::Uint32> Nan::ToArrayIndex(v8::Local<v8::Value> val);
  116. ```
  117. <a name="api_nan_equals"></a>
  118. ### Nan::Equals()
  119. A helper method for calling [`v8::Value#Equals()`](https://v8docs.nodesource.com/node-8.11/dc/d0a/classv8_1_1_value.html#a08fba1d776a59bbf6864b25f9152c64b) in a way compatible across supported versions of V8.
  120. Signature:
  121. ```c++
  122. Nan::Maybe<bool> Nan::Equals(v8::Local<v8::Value> a, v8::Local<v8::Value>(b));
  123. ```
  124. <a name="api_nan_new_instance"></a>
  125. ### Nan::NewInstance()
  126. A helper method for calling [`v8::Function#NewInstance()`](https://v8docs.nodesource.com/node-8.11/d5/d54/classv8_1_1_function.html#ae477558b10c14b76ed00e8dbab44ce5b) and [`v8::ObjectTemplate#NewInstance()`](https://v8docs.nodesource.com/node-8.11/db/d5f/classv8_1_1_object_template.html#ad605a7543cfbc5dab54cdb0883d14ae4) in a way compatible across supported versions of V8.
  127. Signature:
  128. ```c++
  129. Nan::MaybeLocal<v8::Object> Nan::NewInstance(v8::Local<v8::Function> h);
  130. Nan::MaybeLocal<v8::Object> Nan::NewInstance(v8::Local<v8::Function> h, int argc, v8::Local<v8::Value> argv[]);
  131. Nan::MaybeLocal<v8::Object> Nan::NewInstance(v8::Local<v8::ObjectTemplate> h);
  132. ```
  133. <a name="api_nan_get_function"></a>
  134. ### Nan::GetFunction()
  135. A helper method for calling [`v8::FunctionTemplate#GetFunction()`](https://v8docs.nodesource.com/node-8.11/d8/d83/classv8_1_1_function_template.html#a56d904662a86eca78da37d9bb0ed3705) in a way compatible across supported versions of V8.
  136. Signature:
  137. ```c++
  138. Nan::MaybeLocal<v8::Function> Nan::GetFunction(v8::Local<v8::FunctionTemplate> t);
  139. ```
  140. <a name="api_nan_set"></a>
  141. ### Nan::Set()
  142. A helper method for calling [`v8::Object#Set()`](https://v8docs.nodesource.com/node-8.11/db/d85/classv8_1_1_object.html#a67604ea3734f170c66026064ea808f20) in a way compatible across supported versions of V8.
  143. Signature:
  144. ```c++
  145. Nan::Maybe<bool> Nan::Set(v8::Local<v8::Object> obj,
  146. v8::Local<v8::Value> key,
  147. v8::Local<v8::Value> value)
  148. Nan::Maybe<bool> Nan::Set(v8::Local<v8::Object> obj,
  149. uint32_t index,
  150. v8::Local<v8::Value> value);
  151. ```
  152. <a name="api_nan_define_own_property"></a>
  153. ### Nan::DefineOwnProperty()
  154. A helper method for calling [`v8::Object#DefineOwnProperty()`](https://v8docs.nodesource.com/node-8.11/db/d85/classv8_1_1_object.html#a6f76b2ed605cb8f9185b92de0033a820) in a way compatible across supported versions of V8.
  155. Signature:
  156. ```c++
  157. Nan::Maybe<bool> Nan::DefineOwnProperty(v8::Local<v8::Object> obj,
  158. v8::Local<v8::String> key,
  159. v8::Local<v8::Value> value,
  160. v8::PropertyAttribute attribs = v8::None);
  161. ```
  162. <a name="api_nan_force_set"></a>
  163. ### <del>Nan::ForceSet()</del>
  164. Deprecated, use <a href="#api_nan_define_own_property"><code>Nan::DefineOwnProperty()</code></a>.
  165. <del>A helper method for calling [`v8::Object#ForceSet()`](https://v8docs.nodesource.com/node-0.12/db/d85/classv8_1_1_object.html#acfbdfd7427b516ebdb5c47c4df5ed96c) in a way compatible across supported versions of V8.</del>
  166. Signature:
  167. ```c++
  168. NAN_DEPRECATED Nan::Maybe<bool> Nan::ForceSet(v8::Local<v8::Object> obj,
  169. v8::Local<v8::Value> key,
  170. v8::Local<v8::Value> value,
  171. v8::PropertyAttribute attribs = v8::None);
  172. ```
  173. <a name="api_nan_get"></a>
  174. ### Nan::Get()
  175. A helper method for calling [`v8::Object#Get()`](https://v8docs.nodesource.com/node-8.11/db/d85/classv8_1_1_object.html#a2565f03e736694f6b1e1cf22a0b4eac2) in a way compatible across supported versions of V8.
  176. Signature:
  177. ```c++
  178. Nan::MaybeLocal<v8::Value> Nan::Get(v8::Local<v8::Object> obj,
  179. v8::Local<v8::Value> key);
  180. Nan::MaybeLocal<v8::Value> Nan::Get(v8::Local<v8::Object> obj, uint32_t index);
  181. ```
  182. <a name="api_nan_get_property_attribute"></a>
  183. ### Nan::GetPropertyAttributes()
  184. A helper method for calling [`v8::Object#GetPropertyAttributes()`](https://v8docs.nodesource.com/node-8.11/db/d85/classv8_1_1_object.html#a9b898894da3d1db2714fd9325a54fe57) in a way compatible across supported versions of V8.
  185. Signature:
  186. ```c++
  187. Nan::Maybe<v8::PropertyAttribute> Nan::GetPropertyAttributes(
  188. v8::Local<v8::Object> obj,
  189. v8::Local<v8::Value> key);
  190. ```
  191. <a name="api_nan_has"></a>
  192. ### Nan::Has()
  193. A helper method for calling [`v8::Object#Has()`](https://v8docs.nodesource.com/node-8.11/db/d85/classv8_1_1_object.html#ab3c3d89ea7c2f9afd08965bd7299a41d) in a way compatible across supported versions of V8.
  194. Signature:
  195. ```c++
  196. Nan::Maybe<bool> Nan::Has(v8::Local<v8::Object> obj, v8::Local<v8::String> key);
  197. Nan::Maybe<bool> Nan::Has(v8::Local<v8::Object> obj, uint32_t index);
  198. ```
  199. <a name="api_nan_delete"></a>
  200. ### Nan::Delete()
  201. A helper method for calling [`v8::Object#Delete()`](https://v8docs.nodesource.com/node-8.11/db/d85/classv8_1_1_object.html#a48e4a19b2cedff867eecc73ddb7d377f) in a way compatible across supported versions of V8.
  202. Signature:
  203. ```c++
  204. Nan::Maybe<bool> Nan::Delete(v8::Local<v8::Object> obj,
  205. v8::Local<v8::String> key);
  206. Nan::Maybe<bool> Nan::Delete(v8::Local<v8::Object> obj, uint32_t index);
  207. ```
  208. <a name="api_nan_get_property_names"></a>
  209. ### Nan::GetPropertyNames()
  210. A helper method for calling [`v8::Object#GetPropertyNames()`](https://v8docs.nodesource.com/node-8.11/db/d85/classv8_1_1_object.html#aced885270cfd2c956367b5eedc7fbfe8) in a way compatible across supported versions of V8.
  211. Signature:
  212. ```c++
  213. Nan::MaybeLocal<v8::Array> Nan::GetPropertyNames(v8::Local<v8::Object> obj);
  214. ```
  215. <a name="api_nan_get_own_property_names"></a>
  216. ### Nan::GetOwnPropertyNames()
  217. A helper method for calling [`v8::Object#GetOwnPropertyNames()`](https://v8docs.nodesource.com/node-8.11/db/d85/classv8_1_1_object.html#a79a6e4d66049b9aa648ed4dfdb23e6eb) in a way compatible across supported versions of V8.
  218. Signature:
  219. ```c++
  220. Nan::MaybeLocal<v8::Array> Nan::GetOwnPropertyNames(v8::Local<v8::Object> obj);
  221. ```
  222. <a name="api_nan_set_prototype"></a>
  223. ### Nan::SetPrototype()
  224. A helper method for calling [`v8::Object#SetPrototype()`](https://v8docs.nodesource.com/node-8.11/db/d85/classv8_1_1_object.html#a442706b22fceda6e6d1f632122a9a9f4) in a way compatible across supported versions of V8.
  225. Signature:
  226. ```c++
  227. Nan::Maybe<bool> Nan::SetPrototype(v8::Local<v8::Object> obj,
  228. v8::Local<v8::Value> prototype);
  229. ```
  230. <a name="api_nan_object_proto_to_string"></a>
  231. ### Nan::ObjectProtoToString()
  232. A helper method for calling [`v8::Object#ObjectProtoToString()`](https://v8docs.nodesource.com/node-8.11/db/d85/classv8_1_1_object.html#ab7a92b4dcf822bef72f6c0ac6fea1f0b) in a way compatible across supported versions of V8.
  233. Signature:
  234. ```c++
  235. Nan::MaybeLocal<v8::String> Nan::ObjectProtoToString(v8::Local<v8::Object> obj);
  236. ```
  237. <a name="api_nan_has_own_property"></a>
  238. ### Nan::HasOwnProperty()
  239. A helper method for calling [`v8::Object#HasOwnProperty()`](https://v8docs.nodesource.com/node-8.11/db/d85/classv8_1_1_object.html#ab7b7245442ca6de1e1c145ea3fd653ff) in a way compatible across supported versions of V8.
  240. Signature:
  241. ```c++
  242. Nan::Maybe<bool> Nan::HasOwnProperty(v8::Local<v8::Object> obj,
  243. v8::Local<v8::String> key);
  244. ```
  245. <a name="api_nan_has_real_named_property"></a>
  246. ### Nan::HasRealNamedProperty()
  247. A helper method for calling [`v8::Object#HasRealNamedProperty()`](https://v8docs.nodesource.com/node-8.11/db/d85/classv8_1_1_object.html#ad8b80a59c9eb3c1e6c3cd6c84571f767) in a way compatible across supported versions of V8.
  248. Signature:
  249. ```c++
  250. Nan::Maybe<bool> Nan::HasRealNamedProperty(v8::Local<v8::Object> obj,
  251. v8::Local<v8::String> key);
  252. ```
  253. <a name="api_nan_has_real_indexed_property"></a>
  254. ### Nan::HasRealIndexedProperty()
  255. A helper method for calling [`v8::Object#HasRealIndexedProperty()`](https://v8docs.nodesource.com/node-8.11/db/d85/classv8_1_1_object.html#af94fc1135a5e74a2193fb72c3a1b9855) in a way compatible across supported versions of V8.
  256. Signature:
  257. ```c++
  258. Nan::Maybe<bool> Nan::HasRealIndexedProperty(v8::Local<v8::Object> obj,
  259. uint32_t index);
  260. ```
  261. <a name="api_nan_has_real_named_callback_property"></a>
  262. ### Nan::HasRealNamedCallbackProperty()
  263. A helper method for calling [`v8::Object#HasRealNamedCallbackProperty()`](https://v8docs.nodesource.com/node-8.11/db/d85/classv8_1_1_object.html#af743b7ea132b89f84d34d164d0668811) in a way compatible across supported versions of V8.
  264. Signature:
  265. ```c++
  266. Nan::Maybe<bool> Nan::HasRealNamedCallbackProperty(
  267. v8::Local<v8::Object> obj,
  268. v8::Local<v8::String> key);
  269. ```
  270. <a name="api_nan_get_real_named_property_in_prototype_chain"></a>
  271. ### Nan::GetRealNamedPropertyInPrototypeChain()
  272. A helper method for calling [`v8::Object#GetRealNamedPropertyInPrototypeChain()`](https://v8docs.nodesource.com/node-8.11/db/d85/classv8_1_1_object.html#a8700b1862e6b4783716964ba4d5e6172) in a way compatible across supported versions of V8.
  273. Signature:
  274. ```c++
  275. Nan::MaybeLocal<v8::Value> Nan::GetRealNamedPropertyInPrototypeChain(
  276. v8::Local<v8::Object> obj,
  277. v8::Local<v8::String> key);
  278. ```
  279. <a name="api_nan_get_real_named_property"></a>
  280. ### Nan::GetRealNamedProperty()
  281. A helper method for calling [`v8::Object#GetRealNamedProperty()`](https://v8docs.nodesource.com/node-8.11/db/d85/classv8_1_1_object.html#a84471a824576a5994fdd0ffcbf99ccc0) in a way compatible across supported versions of V8.
  282. Signature:
  283. ```c++
  284. Nan::MaybeLocal<v8::Value> Nan::GetRealNamedProperty(v8::Local<v8::Object> obj,
  285. v8::Local<v8::String> key);
  286. ```
  287. <a name="api_nan_call_as_function"></a>
  288. ### Nan::CallAsFunction()
  289. A helper method for calling [`v8::Object#CallAsFunction()`](https://v8docs.nodesource.com/node-8.11/db/d85/classv8_1_1_object.html#ad3ffc36f3dfc3592ce2a96bc047ee2cd) in a way compatible across supported versions of V8.
  290. Signature:
  291. ```c++
  292. Nan::MaybeLocal<v8::Value> Nan::CallAsFunction(v8::Local<v8::Object> obj,
  293. v8::Local<v8::Object> recv,
  294. int argc,
  295. v8::Local<v8::Value> argv[]);
  296. ```
  297. <a name="api_nan_call_as_constructor"></a>
  298. ### Nan::CallAsConstructor()
  299. A helper method for calling [`v8::Object#CallAsConstructor()`](https://v8docs.nodesource.com/node-8.11/db/d85/classv8_1_1_object.html#a50d571de50d0b0dfb28795619d07a01b) in a way compatible across supported versions of V8.
  300. Signature:
  301. ```c++
  302. Nan::MaybeLocal<v8::Value> Nan::CallAsConstructor(v8::Local<v8::Object> obj,
  303. int argc,
  304. v8::Local<v8::Value> argv[]);
  305. ```
  306. <a name="api_nan_get_source_line"></a>
  307. ### Nan::GetSourceLine()
  308. A helper method for calling [`v8::Message#GetSourceLine()`](https://v8docs.nodesource.com/node-8.11/d9/d28/classv8_1_1_message.html#a849f7a6c41549d83d8159825efccd23a) in a way compatible across supported versions of V8.
  309. Signature:
  310. ```c++
  311. Nan::MaybeLocal<v8::String> Nan::GetSourceLine(v8::Local<v8::Message> msg);
  312. ```
  313. <a name="api_nan_get_line_number"></a>
  314. ### Nan::GetLineNumber()
  315. A helper method for calling [`v8::Message#GetLineNumber()`](https://v8docs.nodesource.com/node-8.11/d9/d28/classv8_1_1_message.html#adbe46c10a88a6565f2732a2d2adf99b9) in a way compatible across supported versions of V8.
  316. Signature:
  317. ```c++
  318. Nan::Maybe<int> Nan::GetLineNumber(v8::Local<v8::Message> msg);
  319. ```
  320. <a name="api_nan_get_start_column"></a>
  321. ### Nan::GetStartColumn()
  322. A helper method for calling [`v8::Message#GetStartColumn()`](https://v8docs.nodesource.com/node-8.11/d9/d28/classv8_1_1_message.html#a60ede616ba3822d712e44c7a74487ba6) in a way compatible across supported versions of V8.
  323. Signature:
  324. ```c++
  325. Nan::Maybe<int> Nan::GetStartColumn(v8::Local<v8::Message> msg);
  326. ```
  327. <a name="api_nan_get_end_column"></a>
  328. ### Nan::GetEndColumn()
  329. A helper method for calling [`v8::Message#GetEndColumn()`](https://v8docs.nodesource.com/node-8.11/d9/d28/classv8_1_1_message.html#aaa004cf19e529da980bc19fcb76d93be) in a way compatible across supported versions of V8.
  330. Signature:
  331. ```c++
  332. Nan::Maybe<int> Nan::GetEndColumn(v8::Local<v8::Message> msg);
  333. ```
  334. <a name="api_nan_clone_element_at"></a>
  335. ### Nan::CloneElementAt()
  336. A helper method for calling [`v8::Array#CloneElementAt()`](https://v8docs.nodesource.com/node-4.8/d3/d32/classv8_1_1_array.html#a1d3a878d4c1c7cae974dd50a1639245e) in a way compatible across supported versions of V8.
  337. Signature:
  338. ```c++
  339. Nan::MaybeLocal<v8::Object> Nan::CloneElementAt(v8::Local<v8::Array> array, uint32_t index);
  340. ```
  341. <a name="api_nan_has_private"></a>
  342. ### Nan::HasPrivate()
  343. A helper method for calling [`v8::Object#HasPrivate()`](https://v8docs.nodesource.com/node-8.11/db/d85/classv8_1_1_object.html#af68a0b98066cfdeb8f943e98a40ba08d) in a way compatible across supported versions of V8.
  344. Signature:
  345. ```c++
  346. Nan::Maybe<bool> Nan::HasPrivate(v8::Local<v8::Object> object, v8::Local<v8::String> key);
  347. ```
  348. <a name="api_nan_get_private"></a>
  349. ### Nan::GetPrivate()
  350. A helper method for calling [`v8::Object#GetPrivate()`](https://v8docs.nodesource.com/node-8.11/db/d85/classv8_1_1_object.html#a169f2da506acbec34deadd9149a1925a) in a way compatible across supported versions of V8.
  351. Signature:
  352. ```c++
  353. Nan::MaybeLocal<v8::Value> Nan::GetPrivate(v8::Local<v8::Object> object, v8::Local<v8::String> key);
  354. ```
  355. <a name="api_nan_set_private"></a>
  356. ### Nan::SetPrivate()
  357. A helper method for calling [`v8::Object#SetPrivate()`](https://v8docs.nodesource.com/node-8.11/db/d85/classv8_1_1_object.html#ace1769b0f3b86bfe9fda1010916360ee) in a way compatible across supported versions of V8.
  358. Signature:
  359. ```c++
  360. Nan::Maybe<bool> Nan::SetPrivate(v8::Local<v8::Object> object, v8::Local<v8::String> key, v8::Local<v8::Value> value);
  361. ```
  362. <a name="api_nan_delete_private"></a>
  363. ### Nan::DeletePrivate()
  364. A helper method for calling [`v8::Object#DeletePrivate()`](https://v8docs.nodesource.com/node-8.11/db/d85/classv8_1_1_object.html#a138bb32a304f3982be02ad499693b8fd) in a way compatible across supported versions of V8.
  365. Signature:
  366. ```c++
  367. Nan::Maybe<bool> Nan::DeletePrivate(v8::Local<v8::Object> object, v8::Local<v8::String> key);
  368. ```
  369. <a name="api_nan_make_maybe"></a>
  370. ### Nan::MakeMaybe()
  371. Wraps a `v8::Local<>` in a `Nan::MaybeLocal<>`. When called with a `Nan::MaybeLocal<>` it just returns its argument. This is useful in generic template code that builds on NAN.
  372. Synopsis:
  373. ```c++
  374. MaybeLocal<v8::Number> someNumber = MakeMaybe(New<v8::Number>(3.141592654));
  375. MaybeLocal<v8::String> someString = MakeMaybe(New<v8::String>("probably"));
  376. ```
  377. Signature:
  378. ```c++
  379. template <typename T, template <typename> class MaybeMaybe>
  380. Nan::MaybeLocal<T> Nan::MakeMaybe(MaybeMaybe<T> v);
  381. ```