-
Notifications
You must be signed in to change notification settings - Fork 465
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
doc: some fix on
Napi::Boolean
documentation
PR-URL: #354 Reviewed-By: Michael Dawson <[email protected]>
- Loading branch information
Showing
3 changed files
with
78 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,64 @@ | ||
# Boolean | ||
|
||
# Methods | ||
`Napi::Boolean` class is a representation of the JavaScript `Boolean` object. The | ||
`Napi::Boolean` class inherits its behavior from the `Napi::Value` class | ||
(for more info see: [`Napi::Value`](value.md)). | ||
|
||
## Methods | ||
|
||
### Constructor | ||
|
||
Creates a new empty instance of an `Napi::Boolean` object. | ||
|
||
```cpp | ||
Napi::Boolean::New(Napi::Env env, bool value); | ||
Napi::Boolean::Boolean(); | ||
``` | ||
- `[in] env`: The `napi_env` Environment | ||
- `[in] value`: The Javascript boolean value | ||
|
||
Returns a new _empty_ `Napi::Boolean` object. | ||
|
||
### Contructor | ||
|
||
Creates a new instance of the `Napi::Boolean` object. | ||
|
||
```cpp | ||
Napi::Boolean::Boolean(); | ||
Napi::Boolean(napi_env env, napi_value value); | ||
``` | ||
returns a new empty Javascript Boolean value type. | ||
### operator bool | ||
Converts a `Napi::Boolean` value to a boolean primitive. | ||
- `[in] env`: The `napi_env` environment in which to construct the `Napi::Boolean` object. | ||
- `[in] value`: The `napi_value` which is a handle for a JavaScript `Boolean`. | ||
Returns a non-empty `Napi::Boolean` object. | ||
### New | ||
Initializes a new instance of the `Napi::Boolean` object. | ||
```cpp | ||
Napi::Boolean::operator bool() const; | ||
Napi::Boolean Napi::Boolean::New(napi_env env, bool value); | ||
``` | ||
- `[in] env`: The `napi_env` environment in which to construct the `Napi::Boolean` object. | ||
- `[in] value`: The primitive boolean value (`true` or `false`). | ||
|
||
Returns a new instance of the `Napi::Boolean` object. | ||
|
||
### Value | ||
|
||
Converts a `Napi::Boolean` value to a boolean primitive. | ||
|
||
```cpp | ||
bool Napi::Boolean::Value() const; | ||
``` | ||
|
||
Returns the boolean primitive type of the corresponding `Napi::Boolean` object. | ||
|
||
## Operators | ||
|
||
### operator bool | ||
|
||
Converts a `Napi::Boolean` value to a boolean primitive. | ||
|
||
```cpp | ||
Napi::Boolean::operator bool() const; | ||
``` | ||
|
||
Returns the boolean primitive type of the corresponding `Napi::Boolean` object. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters