Skip to content

Commit ccfcd55

Browse files
corymickelsonmhdawson
authored andcommitted
doc: string, bool, and cmake-js napi link
PR Metadata PR-URL: #203 Reviewed-By: Michael Dawson <[email protected]>1
1 parent 5441b3c commit ccfcd55

File tree

3 files changed

+79
-4
lines changed

3 files changed

+79
-4
lines changed

doc/boolean.md

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,33 @@
11
# Boolean
22

3-
You are reading a draft of the next documentation and it's in continuos update so
3+
You are reading a draft of the next documentation and it's in continuous update so
44
if you don't find what you need please refer to:
5-
[C++ wrapper classes for the ABI-stable C APIs for Node.js](https://nodejs.github.io/node-addon-api/)
5+
[C++ wrapper classes for the ABI-stable C APIs for Node.js](https://nodejs.github.io/node-addon-api/)
6+
7+
# Methods
8+
9+
### Constructor
10+
11+
```cpp
12+
Napi::Boolean::New(Napi::Env env, bool value);
13+
```
14+
- `[in] env`: The `napi_env` Environment
15+
- `[in] value`: The Javascript boolean value
16+
17+
```cpp
18+
Napi::Boolean();
19+
```
20+
returns a new empty Javascript Boolean value type.
21+
22+
### operator bool
23+
Converts a Boolean value to a boolean primitive.
24+
```cpp
25+
operator bool() const;
26+
```
27+
28+
### Value
29+
Converts a Boolean value to a boolean primitive.
30+
31+
```cpp
32+
bool Value() const;
33+
```

doc/cmake-js.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ instead of Google's **gyp** format it is base on **CMake** build system.
88

99
- [Installation](https://www.npmjs.com/package/cmake-js#installation)
1010
- [How to use](https://www.npmjs.com/package/cmake-js#usage)
11+
- [Using N-API and node-addon-api](https://github.com/cmake-js/cmake-js#n-api-and-node-addon-api)
1112
- [Tutorials](https://www.npmjs.com/package/cmake-js#tutorials)
1213
- [Use case in the works - ArrayFire.js](https://www.npmjs.com/package/cmake-js#use-case-in-the-works---arrayfirejs)
1314

doc/string.md

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,51 @@
11
# String
22

3-
You are reading a draft of the next documentation and it's in continuos update so
3+
You are reading a draft of the next documentation and it's in continuous update so
44
if you don't find what you need please refer to:
5-
[C++ wrapper classes for the ABI-stable C APIs for Node.js](https://nodejs.github.io/node-addon-api/)
5+
[C++ wrapper classes for the ABI-stable C APIs for Node.js](https://nodejs.github.io/node-addon-api/)
6+
# Methods
7+
8+
### Constructor
9+
10+
Creates a new String value from a UTF-8 encoded c++ string.
11+
12+
```cpp
13+
String::New(napi_env env, const std::string& value);
14+
```
15+
16+
- `[in] env`: The `napi_env` environment in which to construct the Value object.
17+
- `[in] value`: The C++ primitive from which to instantiate the Value. `value` may be any of:
18+
- std::string&
19+
- std::u16string&
20+
- const char*
21+
- const char16_t*
22+
23+
Creates a new empty String
24+
25+
```cpp
26+
String::New();
27+
```
28+
29+
### operator std::string
30+
31+
```cpp
32+
operator std::string() const;
33+
```
34+
Converts a String value to a UTF-8 encoded C++ string.
35+
36+
### operator std::u16string
37+
```cpp
38+
operator std::u16string() const;
39+
```
40+
Converts a String value to a UTF-16 encoded C++ string.
41+
42+
### Utf8Value
43+
```cpp
44+
std::string Utf8Value() const;
45+
```
46+
Converts a String value to a UTF-8 encoded C++ string.
47+
### Utf16Value
48+
```cpp
49+
std::u16string Utf16Value() const;
50+
```
51+
Converts a String value to a UTF-16 encoded C++ string.

0 commit comments

Comments
 (0)