|
1 | 1 | # Boolean
|
2 | 2 |
|
3 |
| -# Methods |
| 3 | +`Napi::Boolean` class is a representation of the JavaScript `Boolean` object. The |
| 4 | +`Napi::Boolean` class inherits its behavior from the `Napi::Value` class |
| 5 | +(for more info see: [`Napi::Value`](value.md)). |
| 6 | + |
| 7 | +## Methods |
4 | 8 |
|
5 | 9 | ### Constructor
|
6 | 10 |
|
| 11 | +Creates a new empty instance of an `Napi::Boolean` object. |
| 12 | + |
7 | 13 | ```cpp
|
8 |
| -Napi::Boolean::New(Napi::Env env, bool value); |
| 14 | +Napi::Boolean::Boolean(); |
9 | 15 | ```
|
10 |
| - - `[in] env`: The `napi_env` Environment |
11 |
| - - `[in] value`: The Javascript boolean value |
| 16 | + |
| 17 | +Returns a new _empty_ `Napi::Boolean` object. |
| 18 | + |
| 19 | +### Contructor |
| 20 | + |
| 21 | +Creates a new instance of the `Napi::Boolean` object. |
12 | 22 |
|
13 | 23 | ```cpp
|
14 |
| -Napi::Boolean::Boolean(); |
| 24 | +Napi::Boolean(napi_env env, napi_value value); |
15 | 25 | ```
|
16 |
| -returns a new empty Javascript Boolean value type. |
17 | 26 |
|
18 |
| -### operator bool |
19 |
| -Converts a `Napi::Boolean` value to a boolean primitive. |
| 27 | +- `[in] env`: The `napi_env` environment in which to construct the `Napi::Boolean` object. |
| 28 | +- `[in] value`: The `napi_value` which is a handle for a JavaScript `Boolean`. |
| 29 | +
|
| 30 | +Returns a non-empty `Napi::Boolean` object. |
| 31 | +
|
| 32 | +### New |
| 33 | +
|
| 34 | +Initializes a new instance of the `Napi::Boolean` object. |
| 35 | +
|
20 | 36 | ```cpp
|
21 |
| -Napi::Boolean::operator bool() const; |
| 37 | +Napi::Boolean Napi::Boolean::New(napi_env env, bool value); |
22 | 38 | ```
|
| 39 | +- `[in] env`: The `napi_env` environment in which to construct the `Napi::Boolean` object. |
| 40 | +- `[in] value`: The primitive boolean value (`true` or `false`). |
| 41 | + |
| 42 | +Returns a new instance of the `Napi::Boolean` object. |
23 | 43 |
|
24 | 44 | ### Value
|
| 45 | + |
25 | 46 | Converts a `Napi::Boolean` value to a boolean primitive.
|
26 | 47 |
|
27 | 48 | ```cpp
|
28 | 49 | bool Napi::Boolean::Value() const;
|
29 | 50 | ```
|
| 51 | + |
| 52 | +Returns the boolean primitive type of the corresponding `Napi::Boolean` object. |
| 53 | + |
| 54 | +## Operators |
| 55 | + |
| 56 | +### operator bool |
| 57 | + |
| 58 | +Converts a `Napi::Boolean` value to a boolean primitive. |
| 59 | + |
| 60 | +```cpp |
| 61 | +Napi::Boolean::operator bool() const; |
| 62 | +``` |
| 63 | + |
| 64 | +Returns the boolean primitive type of the corresponding `Napi::Boolean` object. |
0 commit comments