Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add GetPropertyNames, HasOwnProperty, Delete #615

Merged
merged 1 commit into from
Dec 5, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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