0

I am having a problem using c++ n-api api and I have reviewed the documentation here, and I do not see a way to iterate the keys of a Napi::Object. I must be missing something because this is possible in JavaScript, so it must be possible in the C++ API.

How can I list or iterate the keys (properties) in a Napi::Object.

simon-p-r
  • 3,623
  • 2
  • 20
  • 35
Matthew James Briggs
  • 2,085
  • 2
  • 28
  • 58

1 Answers1

2

It seems the Doxygen documentation which Google surfaced at https://nodejs.github.io/node-addon-api/ is out-of-date.

The right place to look is on the Node.js Github repo at https://github.com/nodejs/node-addon-api/blob/master/napi.h

Looking at the correct header version, Napi::Object has a function GetPropertyNames() which is exactly what I needed (though it is oddly not const).

Matthew James Briggs
  • 2,085
  • 2
  • 28
  • 58