We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b639620 commit 0c4c70aCopy full SHA for 0c4c70a
doc/number.md
@@ -0,0 +1,33 @@
1
+# Number
2
+
3
+A Javascript number value.
4
+## Methods
5
6
7
+### Constructor
8
9
+```cpp
10
+Napi::Number::New(Napi::Env env, double value);
11
+```
12
+ - `[in] env`: The `napi_env` Environment
13
+ - `[in] value`: The value the Javascript Number will contain
14
15
16
+Napi::Number();
17
18
+returns a new empty Javascript Number
19
20
+You can easily cast a Javascript number to one of:
21
+ - int32_t
22
+ - uint32_t
23
+ - int64_t
24
+ - float
25
+ - double
26
27
+The following shows an example of casting a number to an uint32_t value.
28
29
30
+uint32_t operatorVal = Number::New(Env(), 10.0); // Number to unsigned 32 bit integer
31
+// or
32
+auto instanceVal = info[0].As<Number>().Uint32Value();
33
0 commit comments