Socket
Socket
Sign inDemoInstall

node-addon-api

Package Overview
Dependencies
Maintainers
5
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-addon-api - npm Package Compare versions

Comparing version 3.0.1 to 3.0.2

doc/addon.md

22

benchmark/function_args.js

@@ -7,7 +7,13 @@ const path = require('path');

.forEach((addonName) => {
const rootAddon = require(`./build/Release/${addonName}`);
const rootAddon = require('bindings')({
bindings: addonName,
module_root: __dirname
});
delete rootAddon.path;
const implems = Object.keys(rootAddon);
const maxNameLength =
implems.reduce((soFar, value) => Math.max(soFar, value.length), 0);
const anObject = {};
console.log(`${addonName}: `);
console.log(`\n${addonName}: `);

@@ -17,3 +23,3 @@ console.log('no arguments:');

const fn = rootAddon[implem].noArgFunction;
return suite.add(implem, () => fn());
return suite.add(implem.padStart(maxNameLength, ' '), () => fn());
}, new Benchmark.Suite)

@@ -26,3 +32,3 @@ .on('cycle', (event) => console.log(String(event.target)))

const fn = rootAddon[implem].oneArgFunction;
return suite.add(implem, () => fn('x'));
return suite.add(implem.padStart(maxNameLength, ' '), () => fn('x'));
}, new Benchmark.Suite)

@@ -35,3 +41,3 @@ .on('cycle', (event) => console.log(String(event.target)))

const fn = rootAddon[implem].twoArgFunction;
return suite.add(implem, () => fn('x', 12));
return suite.add(implem.padStart(maxNameLength, ' '), () => fn('x', 12));
}, new Benchmark.Suite)

@@ -44,3 +50,4 @@ .on('cycle', (event) => console.log(String(event.target)))

const fn = rootAddon[implem].threeArgFunction;
return suite.add(implem, () => fn('x', 12, true));
return suite.add(implem.padStart(maxNameLength, ' '),
() => fn('x', 12, true));
}, new Benchmark.Suite)

@@ -53,3 +60,4 @@ .on('cycle', (event) => console.log(String(event.target)))

const fn = rootAddon[implem].fourArgFunction;
return suite.add(implem, () => fn('x', 12, true, anObject));
return suite.add(implem.padStart(maxNameLength, ' '),
() => fn('x', 12, true, anObject));
}, new Benchmark.Suite)

@@ -56,0 +64,0 @@ .on('cycle', (event) => console.log(String(event.target)))

@@ -7,13 +7,19 @@ const path = require('path');

.forEach((addonName) => {
const rootAddon = require(`./build/Release/${addonName}`);
const rootAddon = require('bindings')({
bindings: addonName,
module_root: __dirname
});
delete rootAddon.path;
const getters = new Benchmark.Suite;
const setters = new Benchmark.Suite;
const maxNameLength = Object.keys(rootAddon)
.reduce((soFar, value) => Math.max(soFar, value.length), 0);
console.log(`${addonName}: `);
console.log(`\n${addonName}: `);
Object.keys(rootAddon).forEach((key) => {
getters.add(`${key} getter`, () => {
getters.add(`${key} getter`.padStart(maxNameLength + 7), () => {
const x = rootAddon[key];
});
setters.add(`${key} setter`, () => {
setters.add(`${key} setter`.padStart(maxNameLength + 7), () => {
rootAddon[key] = 5;

@@ -27,2 +33,4 @@ })

console.log('');
setters

@@ -29,0 +37,0 @@ .on('cycle', (event) => console.log(String(event.target)))

# node-addon-api Changelog
## 2020-09-18 Version 3.0.2, @NickNaso
### Notable changes:
#### API
- Introduced `include_dir` for use with **gyp** in a scalar context.
- Added `Napi::Addon` to help handle the loading of a native add-on into
multiple threads and or multiple times in the same thread.
- Concentrate callbacks provided to core N-API.
- Make sure wrapcallback is used.
#### Documentation
- Added documentation for `Napi::Addon`.
- Added documentation that reports the full class hierarchy.
- Added link to N-API tutorial website.
- Some minor corrections all over the documentation.
#### TEST
- Added tests to check the build process.
- Refactored test for threasfafe function using async/await.
- Converted tests that gc into async functions that await 10 ticks after
each gc.
- Some minor corrections all over the test suite.
### Commits
* [[`51e25f7c39`](https://github.com/nodejs/node-addon-api/commit/51e25f7c39)] - **doc**: remove a file (#815) (Gabriel Schulhof)
* [[`8c9f1809a2`](https://github.com/nodejs/node-addon-api/commit/8c9f1809a2)] - **doc**: add inheritance links and other changes (Gabriel Schulhof) [#798](https://github.com/nodejs/node-addon-api/pull/798)
* [[`6562e6b0ab`](https://github.com/nodejs/node-addon-api/commit/6562e6b0ab)] - **test**: added tests to check the build process (NickNaso) [#808](https://github.com/nodejs/node-addon-api/pull/808)
* [[`a13b36c96e`](https://github.com/nodejs/node-addon-api/commit/a13b36c96e)] - **test**: fix the threasfafe function test (NickNaso) [#807](https://github.com/nodejs/node-addon-api/pull/807)
* [[`f27623ff61`](https://github.com/nodejs/node-addon-api/commit/f27623ff61)] - **build**: introduce include\_dir (Lovell Fuller) [#766](https://github.com/nodejs/node-addon-api/pull/766)
* [[`9aceea71fc`](https://github.com/nodejs/node-addon-api/commit/9aceea71fc)] - **src**: concentrate callbacks provided to core N-API (Gabriel Schulhof) [#786](https://github.com/nodejs/node-addon-api/pull/786)
* [[`2bc45bbffd`](https://github.com/nodejs/node-addon-api/commit/2bc45bbffd)] - **test**: refactor test to use async/await (Velmisov) [#787](https://github.com/nodejs/node-addon-api/pull/787)
* [[`518cfdcdc1`](https://github.com/nodejs/node-addon-api/commit/518cfdcdc1)] - **test**: test ObjectWrap destructor - no HandleScope (David Halls) [#729](https://github.com/nodejs/node-addon-api/pull/729)
* [[`c2cbbd9191`](https://github.com/nodejs/node-addon-api/commit/c2cbbd9191)] - **doc**: add link to n-api tutorial website (#794) (Jim Schlight) [#794](https://github.com/nodejs/node-addon-api/pull/794)
* [[`1c2a8d59b5`](https://github.com/nodejs/node-addon-api/commit/1c2a8d59b5)] - **doc**: Added required return to example (#793) (pacop) [#793](https://github.com/nodejs/node-addon-api/pull/793)
* [[`cec2c76941`](https://github.com/nodejs/node-addon-api/commit/cec2c76941)] - **src**: wrap finalizer callback (Gabriel Schulhof) [#762](https://github.com/nodejs/node-addon-api/pull/762)
* [[`4ce40d22a6`](https://github.com/nodejs/node-addon-api/commit/4ce40d22a6)] - **test**: use assert.strictEqual() (Koki Nishihara) [#777](https://github.com/nodejs/node-addon-api/pull/777)
* [[`461e3640c6`](https://github.com/nodejs/node-addon-api/commit/461e3640c6)] - **test**: string tests together (Gabriel Schulhof) [#773](https://github.com/nodejs/node-addon-api/pull/773)
* [[`5af645f649`](https://github.com/nodejs/node-addon-api/commit/5af645f649)] - **src**: add Addon\<T\> class (Gabriel Schulhof) [#749](https://github.com/nodejs/node-addon-api/pull/749)
* [[`6148fb4bcc`](https://github.com/nodejs/node-addon-api/commit/6148fb4bcc)] - Synchronise Node.js versions in Appveyor Windows CI with Travis (#768) (Lovell Fuller)
## 2020-07-13 Version 3.0.1, @NickNaso

@@ -4,0 +49,0 @@

# ArrayBuffer
Class `Napi::ArrayBuffer` inherits from class [`Napi::Object`][].
The `Napi::ArrayBuffer` class corresponds to the

@@ -130,1 +132,3 @@ [JavaScript `ArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer)

Returns a pointer the wrapped data.
[`Napi::Object`]: ./object.md
# BigInt
Class `Napi::Bigint` inherits from class [`Napi::Value`][].
A JavaScript BigInt value.

@@ -94,1 +96,3 @@

and the number of elements in the array.
[`Napi::Value`]: ./value.md
# Boolean
Class `Napi::Boolean` inherits from class [`Napi::Value`][].
`Napi::Boolean` class is a representation of the JavaScript `Boolean` object. The

@@ -65,1 +67,3 @@ `Napi::Boolean` class inherits its behavior from the `Napi::Value` class

Returns the boolean primitive type of the corresponding `Napi::Boolean` object.
[`Napi::Value`]: ./value.md
# Buffer
Class `Napi::Buffer` inherits from class [`Napi::Uint8Array`][].
The `Napi::Buffer` class creates a projection of raw data that can be consumed by

@@ -141,1 +143,3 @@ script.

Returns the number of `T` elements in the external data.
[`Napi::Uint8Array`]: ./typed_array_of.md
# DataView
Class `Napi::DataView` inherits from class [`Napi::Object`][].
The `Napi::DataView` class corresponds to the

@@ -245,1 +247,3 @@ [JavaScript `DataView`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView)

- `[in] value`: The value to set.
[`Napi::Object`]: ./object.md
# Date
`Napi::Date` class is a representation of the JavaScript `Date` object. The
`Napi::Date` class inherits its behavior from `Napi::Value` class
(for more info see [`Napi::Value`](value.md))
`Napi::Date` class inherits its behavior from the `Napi::Value` class
(for more info see [`Napi::Value`](value.md)).

@@ -7,0 +7,0 @@ ## Methods

# Error
Class `Napi::Error` inherits from class [`Napi::ObjectReference`][] and class [`std::exception`][].
The `Napi::Error` class is a representation of the JavaScript `Error` object that is thrown

@@ -116,1 +118,4 @@ when runtime errors occur. The Error object can also be used as a base object for

exception. This method can be used only if the exception mechanism is enabled.
[`Napi::ObjectReference`]: ./object_reference.md
[`std::exception`]: http://cplusplus.com/reference/exception/exception/
# External (template)
Class `Napi::External<T>` inherits from class [`Napi::Value`][].
The `Napi::External` template class implements the ability to create a `Napi::Value` object with arbitrary C++ data. It is the user's responsibility to manage the memory for the arbitrary C++ data.

@@ -60,1 +62,3 @@

Returns a pointer to the arbitrary C++ data held by the `Napi::External` object.
[`Napi::Value`]: ./value.md

@@ -33,2 +33,3 @@ # Function

exports.Set(String::New(env, "fn"), Function::New<Fn>(env));
return exports;
}

@@ -35,0 +36,0 @@

# Object Wrap
The `Napi::ObjectWrap` class is used to bind the lifetime of C++ code to a
Class `Napi::ObjectWrap<T>` inherits from class [`Napi::InstanceWrap<T>`][].
The `Napi::ObjectWrap<T>` class is used to bind the lifetime of C++ code to a
JavaScript object. Once bound, each time an instance of the JavaScript object

@@ -10,8 +12,8 @@ is created, an instance of the C++ class will also be created. When a method

In order to create a wrapper it's necessary to extend the
`Napi::ObjectWrap`class which contains all the plumbing to connect JavaScript code
with a C++ object. Classes extending `Napi::ObjectWrap` can be instantiated from
JavaScript using the **new** operator, and their methods can be directly invoked
from JavaScript. The **wrap** word refers to a way of grouping methods and state
of the class because it will be necessary write custom code to bridge each of
your C++ class methods.
`Napi::ObjectWrap<T>` class which contains all the plumbing to connect
JavaScript code with a C++ object. Classes extending `Napi::ObjectWrap` can be
instantiated from JavaScript using the **new** operator, and their methods can
be directly invoked from JavaScript. The **wrap** word refers to a way of
grouping methods and state of the class because it will be necessary write
custom code to bridge each of your C++ class methods.

@@ -64,7 +66,8 @@ ## Example

Example::Example(const Napi::CallbackInfo& info) : Napi::ObjectWrap<Example>(info) {
Napi::Env env = info.Env();
// ...
Napi::Number value = info[0].As<Napi::Number>();
this->_value = value.DoubleValue();
Example::Example(const Napi::CallbackInfo& info) :
Napi::ObjectWrap<Example>(info) {
Napi::Env env = info.Env();
// ...
Napi::Number value = info[0].As<Napi::Number>();
this->_value = value.DoubleValue();
}

@@ -120,9 +123,10 @@

At initialization time, the `Napi::ObjectWrap::DefineClass()` method must be used
to hook up the accessor and method callbacks. It takes a list of property
At initialization time, the `Napi::ObjectWrap::DefineClass()` method must be
used to hook up the accessor and method callbacks. It takes a list of property
descriptors, which can be constructed via the various static methods on the base
class.
When JavaScript code invokes the constructor, the constructor callback will create
a new C++ instance and "wrap" it into the newly created JavaScript object.
When JavaScript code invokes the constructor, the constructor callback will
create a new C++ instance and "wrap" it into the newly created JavaScript
object.

@@ -132,7 +136,7 @@ When JavaScript code invokes a method or a property accessor on the class the

For a wrapped object it could be difficult to distinguish between a function called
on a class prototype and a function called on instance of a class. Therefore it is
good practice to save a persistent reference to the class constructor. This allows
the two cases to be distinguished from each other by checking the this object
against the class constructor.
For a wrapped object it could be difficult to distinguish between a function
called on a class prototype and a function called on instance of a class.
Therefore it is good practice to save a persistent reference to the class
constructor. This allows the two cases to be distinguished from each other by
checking the this object against the class constructor.

@@ -176,5 +180,5 @@ ## Methods

static Napi::Function Napi::ObjectWrap::DefineClass(Napi::Env env,
const char* utf8name,
const std::initializer_list<PropertyDescriptor>& properties,
void* data = nullptr);
const char* utf8name,
const std::initializer_list<PropertyDescriptor>& properties,
void* data = nullptr);
```

@@ -218,4 +222,5 @@

Provides an opportunity to run cleanup code that requires access to the `Napi::Env`
before the wrapped native object instance is freed. Override to implement.
Provides an opportunity to run cleanup code that requires access to the
`Napi::Env` before the wrapped native object instance is freed. Override to
implement.

@@ -230,9 +235,11 @@ ```cpp

Creates property descriptor that represents a static method of a JavaScript class.
Creates property descriptor that represents a static method of a JavaScript
class.
```cpp
static Napi::PropertyDescriptor Napi::ObjectWrap::StaticMethod(const char* utf8name,
StaticVoidMethodCallback method,
napi_property_attributes attributes = napi_default,
void* data = nullptr);
static Napi::PropertyDescriptor Napi::ObjectWrap::StaticMethod(
const char* utf8name,
StaticVoidMethodCallback method,
napi_property_attributes attributes = napi_default,
void* data = nullptr);
```

@@ -253,9 +260,11 @@

Creates property descriptor that represents a static method of a JavaScript class.
Creates property descriptor that represents a static method of a JavaScript
class.
```cpp
static Napi::PropertyDescriptor Napi::ObjectWrap::StaticMethod(const char* utf8name,
StaticMethodCallback method,
napi_property_attributes attributes = napi_default,
void* data = nullptr);
static Napi::PropertyDescriptor Napi::ObjectWrap::StaticMethod(
const char* utf8name,
StaticMethodCallback method,
napi_property_attributes attributes = napi_default,
void* data = nullptr);
```

@@ -276,9 +285,10 @@

Creates property descriptor that represents a static method of a JavaScript class.
Creates property descriptor that represents a static method of a JavaScript
class.
```cpp
static Napi::PropertyDescriptor Napi::ObjectWrap::StaticMethod(Symbol name,
StaticVoidMethodCallback method,
napi_property_attributes attributes = napi_default,
void* data = nullptr);
StaticVoidMethodCallback method,
napi_property_attributes attributes = napi_default,
void* data = nullptr);
```

@@ -299,9 +309,10 @@

Creates property descriptor that represents a static method of a JavaScript class.
Creates property descriptor that represents a static method of a JavaScript
class.
```cpp
static Napi::PropertyDescriptor Napi::ObjectWrap::StaticMethod(Symbol name,
StaticMethodCallback method,
napi_property_attributes attributes = napi_default,
void* data = nullptr);
StaticMethodCallback method,
napi_property_attributes attributes = napi_default,
void* data = nullptr);
```

@@ -322,9 +333,11 @@

Creates property descriptor that represents a static method of a JavaScript class.
Creates property descriptor that represents a static method of a JavaScript
class.
```cpp
template <StaticVoidMethodCallback method>
static Napi::PropertyDescriptor Napi::ObjectWrap::StaticMethod(const char* utf8name,
napi_property_attributes attributes = napi_default,
void* data = nullptr);
static Napi::PropertyDescriptor Napi::ObjectWrap::StaticMethod(
const char* utf8name,
napi_property_attributes attributes = napi_default,
void* data = nullptr);
```

@@ -345,9 +358,11 @@

Creates property descriptor that represents a static method of a JavaScript class.
Creates property descriptor that represents a static method of a JavaScript
class.
```cpp
template <StaticMethodCallback method>
static Napi::PropertyDescriptor Napi::ObjectWrap::StaticMethod(const char* utf8name,
napi_property_attributes attributes = napi_default,
void* data = nullptr);
static Napi::PropertyDescriptor Napi::ObjectWrap::StaticMethod(
const char* utf8name,
napi_property_attributes attributes = napi_default,
void* data = nullptr);
```

@@ -368,3 +383,4 @@

Creates property descriptor that represents a static method of a JavaScript class.
Creates property descriptor that represents a static method of a JavaScript
class.

@@ -374,4 +390,4 @@ ```cpp

static Napi::PropertyDescriptor Napi::ObjectWrap::StaticMethod(Symbol name,
napi_property_attributes attributes = napi_default,
void* data = nullptr);
napi_property_attributes attributes = napi_default,
void* data = nullptr);
```

@@ -392,3 +408,4 @@

Creates property descriptor that represents a static method of a JavaScript class.
Creates property descriptor that represents a static method of a JavaScript
class.

@@ -398,4 +415,4 @@ ```cpp

static Napi::PropertyDescriptor Napi::ObjectWrap::StaticMethod(Symbol name,
napi_property_attributes attributes = napi_default,
void* data = nullptr);
napi_property_attributes attributes = napi_default,
void* data = nullptr);
```

@@ -419,7 +436,8 @@

```cpp
static Napi::PropertyDescriptor Napi::ObjectWrap::StaticAccessor(const char* utf8name,
StaticGetterCallback getter,
StaticSetterCallback setter,
napi_property_attributes attributes = napi_default,
void* data = nullptr);
static Napi::PropertyDescriptor Napi::ObjectWrap::StaticAccessor(
const char* utf8name,
StaticGetterCallback getter,
StaticSetterCallback setter,
napi_property_attributes attributes = napi_default,
void* data = nullptr);
```

@@ -429,6 +447,6 @@

accessor property for the class.
- `[in] getter`: The native function to call when a get access to the property of
a JavaScript class is performed.
- `[in] setter`: The native function to call when a set access to the property of
a JavaScript class is performed.
- `[in] getter`: The native function to call when a get access to the property
of a JavaScript class is performed.
- `[in] setter`: The native function to call when a set access to the property
of a JavaScript class is performed.
- `[in] attributes`: The attributes associated with a particular property.

@@ -449,13 +467,13 @@ One or more of `napi_property_attributes`.

static Napi::PropertyDescriptor Napi::ObjectWrap::StaticAccessor(Symbol name,
StaticGetterCallback getter,
StaticSetterCallback setter,
napi_property_attributes attributes = napi_default,
void* data = nullptr);
StaticGetterCallback getter,
StaticSetterCallback setter,
napi_property_attributes attributes = napi_default,
void* data = nullptr);
```
- `[in] name`: Napi:Symbol that represents the name of a static accessor.
- `[in] getter`: The native function to call when a get access to the property of
a JavaScript class is performed.
- `[in] setter`: The native function to call when a set access to the property of
a JavaScript class is performed.
- `[in] getter`: The native function to call when a get access to the property
of a JavaScript class is performed.
- `[in] setter`: The native function to call when a set access to the property
of a JavaScript class is performed.
- `[in] attributes`: The attributes associated with a particular property.

@@ -476,11 +494,12 @@ One or more of `napi_property_attributes`.

template <StaticGetterCallback getter, StaticSetterCallback setter=nullptr>
static Napi::PropertyDescriptor Napi::ObjectWrap::StaticAccessor(const char* utf8name,
napi_property_attributes attributes = napi_default,
void* data = nullptr);
static Napi::PropertyDescriptor Napi::ObjectWrap::StaticAccessor(
const char* utf8name,
napi_property_attributes attributes = napi_default,
void* data = nullptr);
```
- `[in] getter`: The native function to call when a get access to the property of
a JavaScript class is performed.
- `[in] setter`: The native function to call when a set access to the property of
a JavaScript class is performed.
- `[in] getter`: The native function to call when a get access to the property
of a JavaScript class is performed.
- `[in] setter`: The native function to call when a set access to the property
of a JavaScript class is performed.
- `[in] utf8name`: Null-terminated string that represents the name of a static

@@ -504,10 +523,10 @@ accessor property for the class.

static Napi::PropertyDescriptor Napi::ObjectWrap::StaticAccessor(Symbol name,
napi_property_attributes attributes = napi_default,
void* data = nullptr);
napi_property_attributes attributes = napi_default,
void* data = nullptr);
```
- `[in] getter`: The native function to call when a get access to the property of
a JavaScript class is performed.
- `[in] setter`: The native function to call when a set access to the property of
a JavaScript class is performed.
- `[in] getter`: The native function to call when a get access to the property
of a JavaScript class is performed.
- `[in] setter`: The native function to call when a set access to the property
of a JavaScript class is performed.
- `[in] name`: Napi:Symbol that represents the name of a static accessor.

@@ -522,280 +541,2 @@ - `[in] attributes`: The attributes associated with a particular property.

### InstanceMethod
Creates property descriptor that represents an instance method of a JavaScript class.
```cpp
static Napi::PropertyDescriptor Napi::ObjectWrap::InstanceMethod(const char* utf8name,
InstanceVoidMethodCallback method,
napi_property_attributes attributes = napi_default,
void* data = nullptr);
```
- `[in] utf8name`: Null-terminated string that represents the name of an instance
method for the class.
- `[in] method`: The native function that represents an instance method of a
JavaScript class.
- `[in] attributes`: The attributes associated with a particular property.
One or more of `napi_property_attributes`.
- `[in] data`: User-provided data passed into method when it is invoked.
Returns `Napi::PropertyDescriptor` object that represents an instance method of a
JavaScript class.
### InstanceMethod
Creates property descriptor that represents an instance method of a JavaScript class.
```cpp
static Napi::PropertyDescriptor Napi::ObjectWrap::InstanceMethod(const char* utf8name,
InstanceMethodCallback method,
napi_property_attributes attributes = napi_default,
void* data = nullptr);
```
- `[in] utf8name`: Null-terminated string that represents the name of an instance
method for the class.
- `[in] method`: The native function that represents an instance method of a
JavaScript class.
- `[in] attributes`: The attributes associated with a particular property.
One or more of `napi_property_attributes`.
- `[in] data`: User-provided data passed into method when it is invoked.
Returns `Napi::PropertyDescriptor` object that represents an instance method of a
JavaScript class.
### InstanceMethod
Creates property descriptor that represents an instance method of a JavaScript class.
```cpp
static Napi::PropertyDescriptor Napi::ObjectWrap::InstanceMethod(Napi::Symbol name,
InstanceVoidMethodCallback method,
napi_property_attributes attributes = napi_default,
void* data = nullptr);
```
- `[in] name`: The `Napi::Symbol` object whose value is used to identify the
instance method for the class.
- `[in] method`: The native function that represents an instance method of a
JavaScript class.
- `[in] attributes`: The attributes associated with a particular property.
One or more of `napi_property_attributes`.
- `[in] data`: User-provided data passed into method when it is invoked.
Returns `Napi::PropertyDescriptor` object that represents an instance method of a
JavaScript class.
### InstanceMethod
Creates property descriptor that represents an instance method of a JavaScript class.
```cpp
static Napi::PropertyDescriptor Napi::ObjectWrap::InstanceMethod(Napi::Symbol name,
InstanceMethodCallback method,
napi_property_attributes attributes = napi_default,
void* data = nullptr);
```
- `[in] name`: The `Napi::Symbol` object whose value is used to identify the
instance method for the class.
- `[in] method`: The native function that represents an instance method of a
JavaScript class.
- `[in] attributes`: The attributes associated with a particular property.
One or more of `napi_property_attributes`.
- `[in] data`: User-provided data passed into method when it is invoked.
Returns `Napi::PropertyDescriptor` object that represents an instance method of a
JavaScript class.
### InstanceMethod
Creates property descriptor that represents an instance method of a JavaScript class.
```cpp
template <InstanceVoidMethodCallback method>
static Napi::PropertyDescriptor Napi::ObjectWrap::InstanceMethod(const char* utf8name,
napi_property_attributes attributes = napi_default,
void* data = nullptr);
```
- `[in] method`: The native function that represents an instance method of a
JavaScript class.
- `[in] utf8name`: Null-terminated string that represents the name of an instance
method for the class.
- `[in] attributes`: The attributes associated with a particular property.
One or more of `napi_property_attributes`.
- `[in] data`: User-provided data passed into method when it is invoked.
Returns `Napi::PropertyDescriptor` object that represents an instance method of a
JavaScript class.
### InstanceMethod
Creates property descriptor that represents an instance method of a JavaScript class.
```cpp
template <InstanceMethodCallback method>
static Napi::PropertyDescriptor Napi::ObjectWrap::InstanceMethod(const char* utf8name,
napi_property_attributes attributes = napi_default,
void* data = nullptr);
```
- `[in] method`: The native function that represents an instance method of a
JavaScript class.
- `[in] utf8name`: Null-terminated string that represents the name of an instance
method for the class.
- `[in] attributes`: The attributes associated with a particular property.
One or more of `napi_property_attributes`.
- `[in] data`: User-provided data passed into method when it is invoked.
Returns `Napi::PropertyDescriptor` object that represents an instance method of a
JavaScript class.
### InstanceMethod
Creates property descriptor that represents an instance method of a JavaScript class.
```cpp
template <InstanceVoidMethodCallback method>
static Napi::PropertyDescriptor Napi::ObjectWrap::InstanceMethod(Napi::Symbol name,
napi_property_attributes attributes = napi_default,
void* data = nullptr);
```
- `[in] method`: The native function that represents an instance method of a
JavaScript class.
- `[in] name`: The `Napi::Symbol` object whose value is used to identify the
instance method for the class.
- `[in] attributes`: The attributes associated with a particular property.
One or more of `napi_property_attributes`.
- `[in] data`: User-provided data passed into method when it is invoked.
Returns `Napi::PropertyDescriptor` object that represents an instance method of a
JavaScript class.
### InstanceMethod
Creates property descriptor that represents an instance method of a JavaScript class.
```cpp
template <InstanceMethodCallback method>
static Napi::PropertyDescriptor Napi::ObjectWrap::InstanceMethod(Napi::Symbol name,
napi_property_attributes attributes = napi_default,
void* data = nullptr);
```
- `[in] method`: The native function that represents an instance method of a
JavaScript class.
- `[in] name`: The `Napi::Symbol` object whose value is used to identify the
instance method for the class.
- `[in] attributes`: The attributes associated with a particular property.
One or more of `napi_property_attributes`.
- `[in] data`: User-provided data passed into method when it is invoked.
Returns `Napi::PropertyDescriptor` object that represents an instance method of a
JavaScript class.
### InstanceAccessor
Creates property descriptor that represents an instance accessor property of a
JavaScript class.
```cpp
static Napi::PropertyDescriptor Napi::ObjectWrap::InstanceAccessor(const char* utf8name,
InstanceGetterCallback getter,
InstanceSetterCallback setter,
napi_property_attributes attributes = napi_default,
void* data = nullptr);
```
- `[in] utf8name`: Null-terminated string that represents the name of an instance
accessor property for the class.
- `[in] getter`: The native function to call when a get access to the property of
a JavaScript class is performed.
- `[in] setter`: The native function to call when a set access to the property of
a JavaScript class is performed.
- `[in] attributes`: The attributes associated with the particular property.
One or more of `napi_property_attributes`.
- `[in] data`: User-provided data passed into getter or setter when this is invoked.
Returns `Napi::PropertyDescriptor` object that represents an instance accessor
property of a JavaScript class.
### InstanceAccessor
Creates property descriptor that represents an instance accessor property of a
JavaScript class.
```cpp
static Napi::PropertyDescriptor Napi::ObjectWrap::InstanceAccessor(Symbol name,
InstanceGetterCallback getter,
InstanceSetterCallback setter,
napi_property_attributes attributes = napi_default,
void* data = nullptr);
```
- `[in] name`: The `Napi::Symbol` object whose value is used to identify the
instance accessor.
- `[in] getter`: The native function to call when a get access to the property of
a JavaScript class is performed.
- `[in] setter`: The native function to call when a set access to the property of
a JavaScript class is performed.
- `[in] attributes`: The attributes associated with the particular property.
One or more of `napi_property_attributes`.
- `[in] data`: User-provided data passed into getter or setter when this is invoked.
Returns `Napi::PropertyDescriptor` object that represents an instance accessor
property of a JavaScript class.
### InstanceAccessor
Creates property descriptor that represents an instance accessor property of a
JavaScript class.
```cpp
template <InstanceGetterCallback getter, InstanceSetterCallback setter=nullptr>
static Napi::PropertyDescriptor Napi::ObjectWrap::InstanceAccessor(const char* utf8name,
napi_property_attributes attributes = napi_default,
void* data = nullptr);
```
- `[in] getter`: The native function to call when a get access to the property of
a JavaScript class is performed.
- `[in] setter`: The native function to call when a set access to the property of
a JavaScript class is performed.
- `[in] utf8name`: Null-terminated string that represents the name of an instance
accessor property for the class.
- `[in] attributes`: The attributes associated with the particular property.
One or more of `napi_property_attributes`.
- `[in] data`: User-provided data passed into getter or setter when this is invoked.
Returns `Napi::PropertyDescriptor` object that represents an instance accessor
property of a JavaScript class.
### InstanceAccessor
Creates property descriptor that represents an instance accessor property of a
JavaScript class.
```cpp
template <InstanceGetterCallback getter, InstanceSetterCallback setter=nullptr>
static Napi::PropertyDescriptor Napi::ObjectWrap::InstanceAccessor(Symbol name,
napi_property_attributes attributes = napi_default,
void* data = nullptr);
```
- `[in] getter`: The native function to call when a get access to the property of
a JavaScript class is performed.
- `[in] setter`: The native function to call when a set access to the property of
a JavaScript class is performed.
- `[in] name`: The `Napi::Symbol` object whose value is used to identify the
instance accessor.
- `[in] attributes`: The attributes associated with the particular property.
One or more of `napi_property_attributes`.
- `[in] data`: User-provided data passed into getter or setter when this is invoked.
Returns `Napi::PropertyDescriptor` object that represents an instance accessor
property of a JavaScript class.
### StaticValue

@@ -806,5 +547,6 @@

```cpp
static Napi::PropertyDescriptor Napi::ObjectWrap::StaticValue(const char* utf8name,
Napi::Value value,
napi_property_attributes attributes = napi_default);
static Napi::PropertyDescriptor Napi::ObjectWrap::StaticValue(
const char* utf8name,
Napi::Value value,
napi_property_attributes attributes = napi_default);
```

@@ -815,4 +557,5 @@

- `[in] value`: The value that's retrieved by a get access of the property.
- `[in] attributes`: The attributes to be associated with the property in addition
to the napi_static attribute. One or more of `napi_property_attributes`.
- `[in] attributes`: The attributes to be associated with the property in
addition to the napi_static attribute. One or more of
`napi_property_attributes`.

@@ -828,4 +571,4 @@ Returns `Napi::PropertyDescriptor` object that represents an static value

static Napi::PropertyDescriptor Napi::ObjectWrap::StaticValue(Symbol name,
Napi::Value value,
napi_property_attributes attributes = napi_default);
Napi::Value value,
napi_property_attributes attributes = napi_default);
```

@@ -836,4 +579,5 @@

- `[in] value`: The value that's retrieved by a get access of the property.
- `[in] attributes`: The attributes to be associated with the property in addition
to the napi_static attribute. One or more of `napi_property_attributes`.
- `[in] attributes`: The attributes to be associated with the property in
addition to the napi_static attribute. One or more of
`napi_property_attributes`.

@@ -843,36 +587,2 @@ Returns `Napi::PropertyDescriptor` object that represents an static value

### InstanceValue
Creates property descriptor that represents an instance value property of a
JavaScript class.
```cpp
static Napi::PropertyDescriptor Napi::ObjectWrap::InstanceValue(const char* utf8name,
Napi::Value value,
napi_property_attributes attributes = napi_default);
```
- `[in] utf8name`: Null-terminated string that represents the name of the property.
- `[in] value`: The value that's retrieved by a get access of the property.
- `[in] attributes`: The attributes to be associated with the property.
One or more of `napi_property_attributes`.
Returns `Napi::PropertyDescriptor` object that represents an instance value
property of a JavaScript class.
### InstanceValue
Creates property descriptor that represents an instance value property of a
JavaScript class.
```cpp
static Napi::PropertyDescriptor Napi::ObjectWrap::InstanceValue(Symbol name,
Napi::Value value,
napi_property_attributes attributes = napi_default);
```
- `[in] name`: The `Napi::Symbol` object whose value is used to identify the
name of the property.
- `[in] value`: The value that's retrieved by a get access of the property.
- `[in] attributes`: The attributes to be associated with the property.
One or more of `napi_property_attributes`.
Returns `Napi::PropertyDescriptor` object that represents an instance value
[`Napi::InstanceWrap<T>`]: ./instance_wrap.md
# Object
Class `Napi::Object` inherits from class [`Napi::Value`][].
The `Napi::Object` class corresponds to a JavaScript object. It is extended by the following node-addon-api classes that you may use when working with more specific types:
- [`Napi::Value`](value.md) which is extended by [`Napi::Array`](basic_types.md#array)
- [`Napi::Array`](array.md)
- [`Napi::ArrayBuffer`](array_buffer.md)

@@ -195,3 +197,3 @@ - [`Napi::Buffer<T>`](buffer.md)

Returns the names of the enumerable properties of the object as a [`Napi::Array`](basic_types.md#array) of strings.
Returns the names of the enumerable properties of the object as a [`Napi::Array`](array.md) of strings.
The properties whose key is a `Symbol` will not be included.

@@ -277,1 +279,3 @@

Returns an indexed property or array element as a [`Napi::Value`](value.md).
[`Napi::Value`]: ./value.md
# Promise
Class `Napi::Promise` inherits from class [`Napi::Object`][].
The `Napi::Promise` class, along with its `Napi::Promise::Deferred` class, implement the ability to create, resolve, and reject Promise objects.

@@ -75,1 +77,4 @@

* `[in] value`: The N-API primitive value with which to reject the `Napi::Promise`.
[`Napi::Object`]: ./object.md

@@ -29,3 +29,3 @@ # Setup

```gyp
'include_dirs': ["<!@(node -p \"require('node-addon-api').include\")"],
'include_dirs': ["<!(node -p \"require('node-addon-api').include_dir\")"],
```

@@ -32,0 +32,0 @@

# String
Class `Napi::String` inherits from class [`Napi::Name`][].
## Constructor

@@ -90,1 +92,3 @@

Returns a UTF-16 encoded C++ string.
[`Napi::Name`]: ./name.md
# Symbol
Class `Napi::Symbol` inherits from class [`Napi::Name`][].
## Methods

@@ -45,1 +47,3 @@

`Symbol` registry.
[`Napi::Name`]: ./name.md
# TypedArrayOf
Class `Napi::TypedArrayOf<T>` inherits from class [`Napi::TypedArray`][].
The `Napi::TypedArrayOf` class corresponds to the various

@@ -134,1 +136,3 @@ [JavaScript `TypedArray`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray)

start of the array.
[`Napi::TypedArray`]: ./typed_array.md
# TypedArray
Class `Napi::TypedArray` inherits from class [`Napi::Object`][].
The `Napi::TypedArray` class corresponds to the

@@ -75,1 +77,3 @@ [JavaScript `TypedArray`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray)

Returns the length of the array, in bytes.
[`Napi::Object`]: ./object.md
# Value
`Napi::Value` is the C++ manifestation of a JavaScript value.
`Napi::Value` is the C++ manifestation of a JavaScript value. It is the base
class upon which other JavaScript values such as `Napi::Number`,
`Napi::Boolean`, `Napi::String`, and `Napi::Object` are based. It represents a
JavaScript value of an unknown type. It is a thin wrapper around the N-API
datatype `napi_value`. Methods on this class can be used to check the JavaScript
type of the underlying N-API `napi_value` and also to convert to C++ types.
Value is a the base class upon which other JavaScript values such as Number, Boolean, String, and Object are based.
## Constructors
The following classes inherit, either directly or indirectly, from `Napi::Value`:
- [`Napi::Array`](basic_types.md#array)
- [`Napi::ArrayBuffer`](array_buffer.md)
- [`Napi::Boolean`](boolean.md)
- [`Napi::Buffer`](buffer.md)
- [`Napi::Date`](date.md)
- [`Napi::External`](external.md)
- [`Napi::Function`](function.md)
- [`Napi::Name`](name.md)
- [`Napi::Number`](number.md)
- [`Napi::Object`](object.md)
- [`Napi::String`](string.md)
- [`Napi::Symbol`](symbol.md)
- [`Napi::TypedArray`](typed_array.md)
- [`Napi::TypedArrayOf`](typed_array_of.md)
## Methods
### Empty Constructor

@@ -40,5 +26,6 @@

- `[in] env`: The `napi_env` environment in which to construct the `Napi::Value` object.
- `[in] value`: The C++ primitive from which to instantiate the `Napi::Value`. `value` may be any of:
- `[in] env`: The `napi_env` environment in which to construct the `Napi::Value`
object.
- `[in] value`: The C++ primitive from which to instantiate the `Napi::Value`.
value` may be any of:
- `bool`

@@ -54,35 +41,22 @@ - Any integer type

### From
## Operators
```cpp
template <typename T> static Napi::Value Napi::Value::From(napi_env env, const T& value);
```
- `[in] env`: The `napi_env` environment in which to create the `Napi::Value` object.
- `[in] value`: The N-API primitive value from which to create the `Napi::Value` object.
Returns a `Napi::Value` object from an N-API primitive value.
### operator napi_value
```cpp
operator napi_value() const;
Napi::Value::operator napi_value() const;
```
Returns this Value's N-API value primitive.
Returns the underlying N-API `napi_value`. If the instance is _empty_, this
returns `nullptr`.
Returns `nullptr` if this `Napi::Value` is *empty*.
### operator ==
```cpp
bool Napi::Value::operator ==(const Napi::Value& other) const;
```
- `[in] other`: The `Napi::Value` object to be compared.
Returns `true` if this value strictly equals another value, or `false`
otherwise.
Returns a `bool` indicating if this `Napi::Value` strictly equals another `Napi::Value`.
### operator !=

@@ -94,15 +68,19 @@

- `[in] other`: The `Napi::Value` object to be compared.
Returns `false` if this value strictly equals another value, or `true`
otherwise.
Returns a `bool` indicating if this `Napi::Value` does not strictly equal another `Napi::Value`.
## Methods
### StrictEquals
### As
```cpp
bool Napi::Value::StrictEquals(const Napi::Value& other) const;
template <typename T> T Napi::Value::As() const;
```
- `[in] other`: The `Napi::Value` object to be compared.
Returns a `bool` indicating if this `Napi::Value` strictly equals another `Napi::Value`.
Casts to another type of `Napi::Value`, when the actual type is known or
assumed.
This conversion does not coerce the type. Calling any methods inappropriate for
the actual value type will throw `Napi::Error`.
### Env

@@ -114,96 +92,137 @@

Returns the `Napi::Env` environment this value is associated with.
Returns the `Napi::Env` environment this value is associated with. See
[`Napi::Env`](env.md) for more details about environments.
### IsEmpty
### From
```cpp
bool Napi::Value::IsEmpty() const;
template <typename T>
static Napi::Value Napi::Value::From(napi_env env, const T& value);
```
Returns a `bool` indicating if this `Napi::Value` is *empty* (uninitialized).
- `[in] env`: The `napi_env` environment in which to create the `Napi::Value`
object.
- `[in] value`: The N-API primitive value from which to create the `Napi::Value`
object.
An empty `Napi::Value` is invalid, and most attempts to perform an operation on an empty Value will result in an exception.
Note an empty `Napi::Value` is distinct from JavaScript `null` or `undefined`, which are valid values.
Returns a `Napi::Value` object from an N-API primitive value.
When C++ exceptions are disabled at compile time, a method with a `Napi::Value` return type may return an empty Value to indicate a pending exception. So when not using C++ exceptions, callers should check whether this `Napi::Value` is empty before attempting to use it.
This method is used to convert from a C++ type to a JavaScript value.
Here, `value` may be any of:
- `bool` - returns a `Napi::Boolean`.
- Any integer type - returns a `Napi::Number`.
- Any floating point type - returns a `Napi::Number`.
- `const char*` (encoded using UTF-8, null-terminated) - returns a
`Napi::String`.
- `const char16_t*` (encoded using UTF-16-LE, null-terminated) - returns a
`Napi::String`.
- `std::string` (encoded using UTF-8) - returns a `Napi::String`.
- `std::u16string` - returns a `Napi::String`.
- `Napi::Value` - returns a `Napi::Value`.
- `Napi_value` - returns a `Napi::Value`.
### Type
### IsArray
```cpp
napi_valuetype Napi::Value::Type() const;
bool Napi::Value::IsArray() const;
```
Returns the `napi_valuetype` type of the `Napi::Value`.
Returns `true` if the underlying value is a JavaScript `Napi::Array` or `false`
otherwise.
### IsUndefined
### IsArrayBuffer
```cpp
bool Napi::Value::IsUndefined() const;
bool Napi::Value::IsArrayBuffer() const;
```
Returns a `bool` indicating if this `Napi::Value` is an undefined JavaScript value.
Returns `true` if the underlying value is a JavaScript `Napi::ArrayBuffer` or
`false` otherwise.
### IsNull
### IsBoolean
```cpp
bool Napi::Value::IsNull() const;
bool Napi::Value::IsBoolean() const;
```
Returns a `bool` indicating if this `Napi::Value` is a null JavaScript value.
Returns `true` if the underlying value is a JavaScript `true` or JavaScript
`false`, or `false` if the value is not a `Napi::Boolean` value in JavaScript.
### IsBoolean
### IsBuffer
```cpp
bool Napi::Value::IsBoolean() const;
bool Napi::Value::IsBuffer() const;
```
Returns a `bool` indicating if this `Napi::Value` is a JavaScript boolean.
Returns `true` if the underlying value is a Node.js `Napi::Buffer` or `false`
otherwise.
### IsNumber
### IsDataView
```cpp
bool Napi::Value::IsDataView() const;
```
Returns `true` if the underlying value is a JavaScript `Napi::DataView` or
`false` otherwise.
### IsDate
```cpp
bool Napi::Value::IsNumber() const;
bool Napi::Value::IsDate() const;
```
Returns a `bool` indicating if this `Napi::Value` is a JavaScript number.
Returns `true` if the underlying value is a JavaScript `Date` or `false`
otherwise.
### IsString
### IsEmpty
```cpp
bool Napi::Value::IsString() const;
bool Napi::Value::IsEmpty() const;
```
Returns a `bool` indicating if this `Napi::Value` is a JavaScript string.
Returns `true` if the value is uninitialized.
### IsSymbol
An empty `Napi::Value` is invalid, and most attempts to perform an operation on
an empty `Napi::Value` will result in an exception. An empty `Napi::Value` is
distinct from JavaScript `null` or `undefined`, which are valid values.
When C++ exceptions are disabled at compile time, a method with a `Napi::Value`
return type may return an empty `Napi::Value` to indicate a pending exception.
Thus, when C++ exceptions are not being used, callers should check the result of
`Env::IsExceptionPending` before attempting to use the value.
### IsExternal
```cpp
bool Napi::Value::IsSymbol() const;
bool Napi::Value::IsExternal() const;
```
Returns a `bool` indicating if this `Napi::Value` is a JavaScript symbol.
Returns `true` if the underlying value is a N-API external object or `false`
otherwise.
### IsArray
### IsFunction
```cpp
bool Napi::Value::IsArray() const;
bool Napi::Value::IsFunction() const;
```
Returns a `bool` indicating if this `Napi::Value` is a JavaScript array.
Returns `true` if the underlying value is a JavaScript `Napi::Function` or
`false` otherwise.
### IsArrayBuffer
### IsNull
```cpp
bool Napi::Value::IsArrayBuffer() const;
bool Napi::Value::IsNull() const;
```
Returns a `bool` indicating if this `Napi::Value` is a JavaScript array buffer.
Returns `true` if the underlying value is a JavaScript `null` or `false`
otherwise.
### IsTypedArray
### IsNumber
```cpp
bool Napi::Value::IsTypedArray() const;
bool Napi::Value::IsNumber() const;
```
Returns a `bool` indicating if this `Napi::Value` is a JavaScript typed array.
Returns `true` if the underlying value is a JavaScript `Napi::Number` or `false`
otherwise.

@@ -216,38 +235,60 @@ ### IsObject

Returns a `bool` indicating if this `Napi::Value` is JavaScript object.
Returns `true` if the underlying value is a JavaScript `Napi::Object` or `false`
otherwise.
### IsFunction
### IsPromise
```cpp
bool Napi::Value::IsFunction() const;
bool Napi::Value::IsPromise() const;
```
Returns a `bool` indicating if this `Napi::Value` is a JavaScript function.
Returns `true` if the underlying value is a JavaScript `Napi::Promise` or
`false` otherwise.
### IsBuffer
### IsString
```cpp
bool Napi::Value::IsBuffer() const;
bool Napi::Value::IsString() const;
```
Returns a `bool` indicating if this `Napi::Value` is a Node buffer.
Returns `true` if the underlying value is a JavaScript `Napi::String` or `false`
otherwise.
### IsDate
### IsSymbol
```cpp
bool Napi::Value::IsDate() const;
bool Napi::Value::IsSymbol() const;
```
Returns a `bool` indicating if this `Napi::Value` is a JavaScript date.
Returns `true` if the underlying value is a JavaScript `Napi::Symbol` or `false`
otherwise.
### As
### IsTypedArray
```cpp
template <typename T> T Napi::Value::As() const;
bool Napi::Value::IsTypedArray() const;
```
Casts to another type of `Napi::Value`, when the actual type is known or assumed.
Returns `true` if the underlying value is a JavaScript `Napi::TypedArray` or
`false` otherwise.
This conversion does not coerce the type. Calling any methods inappropriate for the actual value type will throw `Napi::Error`.
### IsUndefined
```cpp
bool Napi::Value::IsUndefined() const;
```
Returns `true` if the underlying value is a JavaScript `undefined` or `false`
otherwise.
### StrictEquals
```cpp
bool Napi::Value::StrictEquals(const Napi::Value& other) const;
```
- `[in] other`: The `Napi::Value` object to be compared.
Returns a `bool` indicating if this `Napi::Value` strictly equals another
`Napi::Value`.
### ToBoolean

@@ -259,4 +300,9 @@

Returns the `Napi::Value` coerced to a JavaScript boolean.
Returns a `Napi::Boolean` representing the `Napi::Value`.
This is a wrapper around `napi_coerce_to_boolean`. This will throw a JavaScript
exception if the coercion fails. If C++ exceptions are not being used, callers
should check the result of `Env::IsExceptionPending` before attempting to use
the returned value.
### ToNumber

@@ -270,2 +316,10 @@

### ToObject
```cpp
Napi::Object Napi::Value::ToObject() const;
```
Returns the `Napi::Value` coerced to a JavaScript object.
### ToString

@@ -279,8 +333,16 @@

### ToObject
### Type
```cpp
Napi::Object Napi::Value::ToObject() const;
napi_valuetype Napi::Value::Type() const;
```
Returns the `Napi::Value` coerced to a JavaScript object.
Returns the `napi_valuetype` type of the `Napi::Value`.
[`Napi::Boolean`]: ./boolean.md
[`Napi::BigInt`]: ./bigint.md
[`Napi::Date`]: ./date.md
[`Napi::External`]: ./external.md
[`Napi::Name`]: ./name.md
[`Napi::Number`]: ./number.md
[`Napi::Object`]: ./object.md
const path = require('path');
const include = path.relative('.', __dirname);
const include_dir = path.relative('.', __dirname);
module.exports = {
include: include,
gyp: path.join(include, 'node_api.gyp:nothing'),
include: `"${__dirname}"`, // deprecated, can be removed as part of 4.0.0
include_dir,
gyp: path.join(include_dir, 'node_api.gyp:nothing'),
isNodeApiBuiltin: true,
needsFlag: false
};

@@ -143,2 +143,6 @@ {

{
"name": "Koki Nishihara",
"url": "https://github.com/Nishikoh"
},
{
"name": "Konstantin Tarkus",

@@ -200,2 +204,6 @@ "url": "https://github.com/koistya"

{
"name": "pacop",
"url": "https://github.com/pacop"
},
{
"name": "Philipp Renoth",

@@ -245,2 +253,6 @@ "url": "https://github.com/DaAitch"

{
"name": "Vlad Velmisov",
"url": "https://github.com/Velmisov"
},
{
"name": "Yohei Kishimoto",

@@ -258,2 +270,4 @@ "url": "https://github.com/morokosi"

"benchmark": "^2.1.4",
"fs-extra": "^9.0.1",
"bindings": "^1.5.0",
"safe-buffer": "^5.1.1"

@@ -295,3 +309,3 @@ },

},
"version": "3.0.1"
"version": "3.0.2"
}

@@ -40,2 +40,6 @@ # **node-addon-api module**

The [N-API Resource](http://nodejs.github.io/node-addon-examples/) offers an
excellent orientation and tips for developers just getting started with N-API
and node-addon-api.
- **[Setup](#setup)**

@@ -51,3 +55,3 @@ - **[API Documentation](#api)**

## **Current version: 3.0.1**
## **Current version: 3.0.2**

@@ -82,27 +86,21 @@ (See [CHANGELOG.md](CHANGELOG.md) for complete Changelog)

- [Basic Types](doc/basic_types.md)
- [Array](doc/basic_types.md#array)
- [Symbol](doc/symbol.md)
- [String](doc/string.md)
- [Name](doc/basic_types.md#name)
- [Number](doc/number.md)
- [Date](doc/date.md)
- [BigInt](doc/bigint.md)
- [Boolean](doc/boolean.md)
- [Full Class Hierarchy](doc/hierarchy.md)
- [Addon Structure](doc/addon.md)
- Data Types:
- [Env](doc/env.md)
- [Value](doc/value.md)
- [CallbackInfo](doc/callbackinfo.md)
- [Reference](doc/reference.md)
- [External](doc/external.md)
- [Object](doc/object.md)
- [ObjectReference](doc/object_reference.md)
- [PropertyDescriptor](doc/property_descriptor.md)
- [Error Handling](doc/error_handling.md)
- [Error](doc/error.md)
- [TypeError](doc/type_error.md)
- [RangeError](doc/range_error.md)
- [Object Lifetime Management](doc/object_lifetime_management.md)
- [HandleScope](doc/handle_scope.md)
- [EscapableHandleScope](doc/escapable_handle_scope.md)
- [Working with JavaScript Values](doc/working_with_javascript_values.md)
- [Value](doc/value.md)
- [Name](doc/name.md)
- [Symbol](doc/symbol.md)
- [String](doc/string.md)
- [Number](doc/number.md)
- [Date](doc/date.md)
- [BigInt](doc/bigint.md)
- [Boolean](doc/boolean.md)
- [External](doc/external.md)
- [Object](doc/object.md)
- [Array](doc/array.md)
- [ObjectReference](doc/object_reference.md)
- [PropertyDescriptor](doc/property_descriptor.md)
- [Function](doc/function.md)

@@ -117,2 +115,9 @@ - [FunctionReference](doc/function_reference.md)

- [DataView](doc/dataview.md)
- [Error Handling](doc/error_handling.md)
- [Error](doc/error.md)
- [TypeError](doc/type_error.md)
- [RangeError](doc/range_error.md)
- [Object Lifetime Management](doc/object_lifetime_management.md)
- [HandleScope](doc/handle_scope.md)
- [EscapableHandleScope](doc/escapable_handle_scope.md)
- [Memory Management](doc/memory_management.md)

@@ -119,0 +124,0 @@ - [Async Operations](doc/async_operations.md)

@@ -25,4 +25,4 @@ #! /usr/bin/env node

'binding.gyp': [
[ /([ ]*)'include_dirs': \[/g, '$1\'include_dirs\': [\n$1 \'<!@(node -p "require(\\\'node-addon-api\\\').include")\',' ],
[ /([ ]*)"include_dirs": \[/g, '$1"include_dirs": [\n$1 "<!@(node -p \\"require(\'node-addon-api\').include\\")",' ],
[ /([ ]*)'include_dirs': \[/g, '$1\'include_dirs\': [\n$1 \'<!(node -p "require(\\\'node-addon-api\\\').include_dir")\',' ],
[ /([ ]*)"include_dirs": \[/g, '$1"include_dirs": [\n$1 "<!(node -p \\"require(\'node-addon-api\').include_dir\\")",' ],
[ /[ ]*("|')<!\(node -e ("|'|\\"|\\')require\(("|'|\\"|\\')nan("|'|\\"|\\')\)("|'|\\"|\\')\)("|')(,|)[\r\n]/g, '' ],

@@ -39,4 +39,4 @@ [ /([ ]*)("|')target_name("|'): ("|')(.+?)("|'),/g, '$1$2target_name$2: $4$5$6,\n $2cflags!$2: [ $2-fno-exceptions$2 ],\n $2cflags_cc!$2: [ $2-fno-exceptions$2 ],\n $2xcode_settings$2: { $2GCC_ENABLE_CPP_EXCEPTIONS$2: $2YES$2,\n $2CLANG_CXX_LIBRARY$2: $2libc++$2,\n $2MACOSX_DEPLOYMENT_TARGET$2: $210.7$2,\n },\n $2msvs_settings$2: {\n $2VCCLCompilerTool$2: { $2ExceptionHandling$2: 1 },\n },' ],

'binding.gyp': [
[ /([ ]*)'include_dirs': \[/g, '$1\'include_dirs\': [\n$1 \'<!@(node -p "require(\\\'node-addon-api\\\').include")\',' ],
[ /([ ]*)"include_dirs": \[/g, '$1"include_dirs": [\n$1 "<!@(node -p \'require(\\\"node-addon-api\\\").include\')",' ],
[ /([ ]*)'include_dirs': \[/g, '$1\'include_dirs\': [\n$1 \'<!(node -p "require(\\\'node-addon-api\\\').include_dir")\',' ],
[ /([ ]*)"include_dirs": \[/g, '$1"include_dirs": [\n$1 "<!(node -p \'require(\\\"node-addon-api\\\").include_dir\')",' ],
[ /[ ]*("|')<!\(node -e ("|'|\\"|\\')require\(("|'|\\"|\\')nan("|'|\\"|\\')\)("|'|\\"|\\')\)("|')(,|)[\r\n]/g, '' ],

@@ -43,0 +43,0 @@ [ /([ ]*)("|')target_name("|'): ("|')(.+?)("|'),/g, '$1$2target_name$2: $4$5$6,\n $2cflags!$2: [ $2-fno-exceptions$2 ],\n $2cflags_cc!$2: [ $2-fno-exceptions$2 ],\n $2defines$2: [ $2NAPI_DISABLE_CPP_EXCEPTIONS$2 ],\n $2conditions$2: [\n [\'OS==\"win\"\', { $2defines$2: [ $2_HAS_EXCEPTIONS=1$2 ] }]\n ]' ],

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc