Skip to content

Commit

Permalink
Add GetPropertyNames, HasOwnProperty, Delete (#615)
Browse files Browse the repository at this point in the history
Fixes: #614

PR-URL: #615
Fixes: #614
Reviewed-By: NickNaso <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
  • Loading branch information
tniessen authored and mhdawson committed Dec 5, 2019
1 parent 3acc4b3 commit c584343
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 c584343

Please sign in to comment.