Skip to content

feat: add Object::New overload utilizing node_api_create_object_with_properties - #1735

Open
KevinEady wants to merge 1 commit into
mainfrom
add-node_api_create_object_with_properties
Open

feat: add Object::New overload utilizing node_api_create_object_with_properties#1735
KevinEady wants to merge 1 commit into
mainfrom
add-node_api_create_object_with_properties

Conversation

@KevinEady

Copy link
Copy Markdown
Contributor

Add Object::New overload utilizing node_api_create_object_with_properties

@KevinEady KevinEady moved this from Need Triage to In Progress in Node-API Team Project Jun 5, 2026
@KevinEady
KevinEady force-pushed the add-node_api_create_object_with_properties branch 4 times, most recently from bbf03d9 to ef2601b Compare June 5, 2026 13:24
@codecov-commenter

codecov-commenter commented Jun 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 63.69%. Comparing base (7223518) to head (23b62a9).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1735   +/-   ##
=======================================
  Coverage   63.69%   63.69%           
=======================================
  Files           3        3           
  Lines        2063     2063           
  Branches      730      730           
=======================================
  Hits         1314     1314           
  Misses        162      162           
  Partials      587      587           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@legendecas

legendecas commented Jun 12, 2026

Copy link
Copy Markdown
Member

The CI failure is nodejs/node-gyp#3327

@KevinEady
KevinEady force-pushed the add-node_api_create_object_with_properties branch 2 times, most recently from eb9b7ef to e725910 Compare July 31, 2026 13:02
@KevinEady
KevinEady marked this pull request as draft July 31, 2026 13:02
@KevinEady
KevinEady force-pushed the add-node_api_create_object_with_properties branch from e725910 to 23b62a9 Compare July 31, 2026 14:30
@KevinEady
KevinEady marked this pull request as ready for review July 31, 2026 14:30
@KevinEady
KevinEady requested a review from legendecas July 31, 2026 14:30
Comment thread napi-inl.h
std::vector<napi_value>& propertyNames,
std::vector<napi_value>& propertyValues) {
if (propertyNames.size() != propertyValues.size()) {
Napi::Error::New(env, "Mismatch in size of property names and values")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should prefer NAPI_THROW to throw as a c++ exception when it is enabled:

Suggested change
Napi::Error::New(env, "Mismatch in size of property names and values")
NAPI_THROW(
Napi::Error::New(env, "Mismatch in size of property names and values"),
Object());

Comment thread napi.h
Comment on lines +911 to +912
std::vector<napi_value>& propertyNames, ///< Property names
std::vector<napi_value>& propertyValues ///< Property values

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could take const vectors:

Suggested change
std::vector<napi_value>& propertyNames, ///< Property names
std::vector<napi_value>& propertyValues ///< Property values
const std::vector<napi_value>& propertyNames, ///< Property names
const std::vector<napi_value>& propertyValues ///< Property values

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

3 participants