Skip to content

Commit c584343

Browse files
tniessenmhdawson
authored andcommitted
Add GetPropertyNames, HasOwnProperty, Delete (#615)
Fixes: #614 PR-URL: #615 Fixes: #614 Reviewed-By: NickNaso <nicoladelgobbo@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
1 parent 3acc4b3 commit c584343

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

doc/object.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,22 @@ While the value must be any of the following types:
101101
- `bool`
102102
- `double`
103103
104+
### Delete()
105+
106+
```cpp
107+
bool Napi::Object::Delete(____ key);
108+
```
109+
- `[in] key`: The name of the property to delete.
110+
111+
Deletes the property associated with the given key. Returns `true` if the property was deleted.
112+
113+
The `key` can be any of the following types:
114+
- `napi_value`
115+
- [`Napi::Value`](value.md)
116+
- `const char *`
117+
- `const std::string &`
118+
- `uint32_t`
119+
104120
### Get()
105121

106122
```cpp
@@ -171,6 +187,29 @@ void finalizeCallback(Napi::Env env, T* data, Hint* hint);
171187
```
172188
where `data` and `hint` are the pointers that were passed into the call to `AddFinalizer()`.
173189
190+
### GetPropertyNames()
191+
```cpp
192+
Napi::Array Napi::Object::GetPropertyNames() const;
193+
```
194+
195+
Returns the names of the enumerable properties of the object as a [`Napi::Array`](basic_types.md#array) of strings.
196+
The properties whose key is a `Symbol` will not be included.
197+
198+
### HasOwnProperty()
199+
```cpp
200+
bool Napi::Object::HasOwnProperty(____ key); const
201+
```
202+
- `[in] key` The name of the property to check.
203+
204+
Returns a `bool` that is *true* if the object has an own property named `key` and *false* otherwise.
205+
206+
The key can be any of the following types:
207+
- `napi_value`
208+
- [`Napi::Value`](value.md)
209+
- `const char*`
210+
- `const std::string&`
211+
- `uint32_t`
212+
174213
### DefineProperty()
175214
176215
```cpp

0 commit comments

Comments
 (0)