@@ -205,26 +205,32 @@ pub const NodeArray = struct {
205205 };
206206 }
207207
208+ /// Gets the number of items in the array.
208209 pub fn len (self : NodeArray.Self ) ! u32 {
209210 var v : u32 = undefined ;
210211 try s2e (c .napi_get_array_length (self .napi_env , self .napi_value , & v ));
211212 return v ;
212213 }
213214
214- /// Gets a NodeValue indicating wether the object has a property with the specified name .
215+ /// Gets the NodeValue at the specified index .
215216 pub fn get (self : NodeArray.Self , index : u32 ) ! NodeValue {
216217 var v : c.napi_value = undefined ;
217218 try s2e (c .napi_get_element (self .napi_env , self .napi_value , index , & v ));
218219 return NodeValue { .napi_env = self .napi_env , .napi_value = v };
219220 }
220221
221- /// Set the specified NodeValue at the specified index of the NodeArray .
222+ /// Sets the specified NodeValue at the specified index.
222223 pub fn set (self : NodeArray.Self , index : u32 , value : NodeValue ) ! NodeValue {
223224 try s2e (c .napi_set_element (self .napi_env , self .napi_value , index , value .napi_value ));
224225 return value ;
225226 }
226227
227- // get/set [], push, splice, etc.
228+ /// Gets whether the array has an element at the specified index.
229+ pub fn has (self : NodeArray.Self , index : u32 ) ! bool {
230+ var v : bool = undefined ;
231+ try s2e (c .napi_has_element (self .napi_env , self .napi_value , index , & v ));
232+ return v ;
233+ }
228234};
229235
230236/// Represents a JS function.
0 commit comments