Skip to content

Commit

Permalink
Add GetPropertyNames, HasOwnProperty, Delete (#615)
Browse files Browse the repository at this point in the history
Fixes: nodejs/node-addon-api#614

PR-URL: nodejs/node-addon-api#615
Fixes: nodejs/node-addon-api#614
Reviewed-By: NickNaso <nicoladelgobbo@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
  • Loading branch information
Marlyfleitas committed Dec 5, 2019
1 parent b7a4507 commit 4f8bab1
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions doc/object.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,22 @@ While the value must be any of the following types:
- `bool`
- `double`
### Delete()
```cpp
bool Napi::Object::Delete(____ key);
```
- `[in] key`: The name of the property to delete.

Deletes the property associated with the given key. Returns `true` if the property was deleted.

The `key` can be any of the following types:
- `napi_value`
- [`Napi::Value`](value.md)
- `const char *`
- `const std::string &`
- `uint32_t`

### Get()

```cpp
Expand Down Expand Up @@ -171,6 +187,29 @@ void finalizeCallback(Napi::Env env, T* data, Hint* hint);
```
where `data` and `hint` are the pointers that were passed into the call to `AddFinalizer()`.
### GetPropertyNames()
```cpp
Napi::Array Napi::Object::GetPropertyNames() const;
```

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

### HasOwnProperty()
```cpp
bool Napi::Object::HasOwnProperty(____ key); const
```
- `[in] key` The name of the property to check.
Returns a `bool` that is *true* if the object has an own property named `key` and *false* otherwise.
The key can be any of the following types:
- `napi_value`
- [`Napi::Value`](value.md)
- `const char*`
- `const std::string&`
- `uint32_t`
### DefineProperty()
```cpp
Expand Down

0 comments on commit 4f8bab1

Please sign in to comment.