nodejs / nodejs/node-addon-api

Migration from NAN to object_wrap / determine invoked property name

Open
#1,114 15 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

never-stale
Dominant language
C++
Stars
2.4k
Forks
499
Avg merge
2d 11h
Merged PRs (30d)
2

Description

This is a usage / migration from NAN question. With NAN I used the following to determine the invoked property name:

NAN_GETTER(ClassName::Getters)
{
        ...        
        std::string propertyName = *Nan::Utf8String(property);
        ...
}

This helped me to reduce C++ boilerplate code for classes with many properties because I did not have to declare and define every single setter and getter method in C++.

Is this still possible?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue mentions NAN getters and object_wrap but names no files or tests. Start by reviewing the node-addon-api migration guidance and the object_wrap accessor APIs, then compare them with the shown NAN pattern. Done means documenting whether the invoked property name can be obtained and giving a supported migration path or stating the limitation.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, nodejs
Domain
api, developer-experience
Issue type
Documentation
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.