|
| 1 | +// Currently experimental guard with NODE_MAJOR_VERISION in which it was |
| 2 | +// released. Once it is no longer experimental guard with the NAPI_VERSION |
| 3 | +// in which it is released instead. |
| 4 | +#if (NODE_MAJOR_VERSION >= 10) |
1 | 5 | #define NAPI_EXPERIMENTAL
|
| 6 | +#endif |
2 | 7 | #include "napi.h"
|
3 | 8 |
|
4 | 9 | using namespace Napi;
|
@@ -65,9 +70,10 @@ Value CreateTypedArray(const CallbackInfo& info) {
|
65 | 70 | NAPI_TYPEDARRAY_NEW(Float64Array, info.Env(), length, napi_float64_array) :
|
66 | 71 | NAPI_TYPEDARRAY_NEW_BUFFER(Float64Array, info.Env(), length, buffer, bufferOffset,
|
67 | 72 | napi_float64_array);
|
68 |
| -// currently experimental guard with version of NAPI_VERSION that it is |
69 |
| -// released in once it is no longer experimental |
70 |
| -#if (NAPI_VERSION > 2147483646) |
| 73 | +// Currently experimental guard with NODE_MAJOR_VERISION in which it was |
| 74 | +// released. Once it is no longer experimental guard with the NAPI_VERSION |
| 75 | +// in which it is released instead. |
| 76 | +#if (NODE_MAJOR_VERSION >= 10) |
71 | 77 | } else if (arrayType == "bigint64") {
|
72 | 78 | return buffer.IsUndefined() ?
|
73 | 79 | NAPI_TYPEDARRAY_NEW(BigInt64Array, info.Env(), length, napi_bigint64_array) :
|
@@ -101,9 +107,10 @@ Value GetTypedArrayType(const CallbackInfo& info) {
|
101 | 107 | case napi_uint32_array: return String::New(info.Env(), "uint32");
|
102 | 108 | case napi_float32_array: return String::New(info.Env(), "float32");
|
103 | 109 | case napi_float64_array: return String::New(info.Env(), "float64");
|
104 |
| -// currently experimental guard with version of NAPI_VERSION that it is |
105 |
| -// released in once it is no longer experimental |
106 |
| -#if (NAPI_VERSION > 2147483646) |
| 110 | +// Currently experimental guard with NODE_MAJOR_VERISION in which it was |
| 111 | +// released. Once it is no longer experimental guard with the NAPI_VERSION |
| 112 | +// in which it is released instead. |
| 113 | +#if (NODE_MAJOR_VERSION >= 10) |
107 | 114 | case napi_bigint64_array: return String::New(info.Env(), "bigint64");
|
108 | 115 | case napi_biguint64_array: return String::New(info.Env(), "biguint64");
|
109 | 116 | #endif
|
@@ -143,9 +150,10 @@ Value GetTypedArrayElement(const CallbackInfo& info) {
|
143 | 150 | return Number::New(info.Env(), array.As<Float32Array>()[index]);
|
144 | 151 | case napi_float64_array:
|
145 | 152 | return Number::New(info.Env(), array.As<Float64Array>()[index]);
|
146 |
| -// currently experimental guard with version of NAPI_VERSION that it is |
147 |
| -// released in once it is no longer experimental |
148 |
| -#if (NAPI_VERSION > 2147483646) |
| 153 | +// Currently experimental guard with NODE_MAJOR_VERISION in which it was |
| 154 | +// released. Once it is no longer experimental guard with the NAPI_VERSION |
| 155 | +// in which it is released instead. |
| 156 | +#if (NODE_MAJOR_VERSION >= 10) |
149 | 157 | case napi_bigint64_array:
|
150 | 158 | return BigInt::New(info.Env(), array.As<BigInt64Array>()[index]);
|
151 | 159 | case napi_biguint64_array:
|
@@ -189,9 +197,10 @@ void SetTypedArrayElement(const CallbackInfo& info) {
|
189 | 197 | case napi_float64_array:
|
190 | 198 | array.As<Float64Array>()[index] = value.DoubleValue();
|
191 | 199 | break;
|
192 |
| -// currently experimental guard with version of NAPI_VERSION that it is |
193 |
| -// released in once it is no longer experimental |
194 |
| -#if (NAPI_VERSION > 2147483646) |
| 200 | +// Currently experimental guard with NODE_MAJOR_VERISION in which it was |
| 201 | +// released. Once it is no longer experimental guard with the NAPI_VERSION |
| 202 | +// in which it is released instead. |
| 203 | +#if (NODE_MAJOR_VERSION >= 10) |
195 | 204 | case napi_bigint64_array: {
|
196 | 205 | bool lossless;
|
197 | 206 | array.As<BigInt64Array>()[index] = value.As<BigInt>().Int64Value(&lossless);
|
|
0 commit comments