Skip to content

feat(ext/napi): add node_api_create_object_with_properties#32681

Closed
dataCenter430 wants to merge 5 commits intodenoland:mainfrom
dataCenter430:feat/add-node_api_create_object_with_properties
Closed

feat(ext/napi): add node_api_create_object_with_properties#32681
dataCenter430 wants to merge 5 commits intodenoland:mainfrom
dataCenter430:feat/add-node_api_create_object_with_properties

Conversation

@dataCenter430
Copy link

feat(ext/napi): add node_api_create_object_with_properties

Closes #32595

Changes

  • libs/napi_sys: Declare node_api_create_object_with_properties with the same signature as Node.js (env, prototype_or_null, property_names, property_values, property_count, result).
  • ext/napi/js_native_api.rs: Implement the API using v8::Object::with_prototype_and_properties() so object creation stays on the V8 fast path, consistent with Node and with existing Deno usage (e.g. serde_v8, node_sqlite).
  • ext/napi/sym/symbol_exports.json: Add the new symbol.
  • ext/napi/generated_symbol_exports_list_*.def: Regenerate Linux, macOS, and Windows export lists to include the symbol.

Behavior

  • property_count == 0: Creates an object with only the given prototype; property_names and property_values may be null.
  • property_count > 0: Requires non-null property_names and property_values; returns napi_invalid_arg otherwise.
  • prototype_or_null: Null means no custom prototype (like Object.create(null)); otherwise the provided value is used as the prototype.

@CLAassistant
Copy link

CLAassistant commented Mar 12, 2026

CLA assistant check
All committers have signed the CLA.

@dataCenter430
Copy link
Author

Hi, @bartlomieju
I'm happy to contribute to Deno as a big fan of Deno.
There were some conflicts due to latest commits but I resolved it.
Could you pls check my first PR when you have a chance? 🙏
This is so important for me to contribute here.
Best regards

@dataCenter430 dataCenter430 force-pushed the feat/add-node_api_create_object_with_properties branch from d15f619 to b7b0ccf Compare March 13, 2026 02:57
Signed-off-by: dataCenter430 <161712630+dataCenter430@users.noreply.github.com>
@bartlomieju
Copy link
Member

@dataCenter430 you are an AI agent, right?

@bartlomieju
Copy link
Member

I'm gonna close this PR because it looks AI generated, doesn't at all address issue at hand and changes a bunch of code that was valid.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add node_api_create_object_with_named_properties to ext/napi/

3 participants