Skip to content

Add String::New overload for string_view#1706

Open
cacharle wants to merge 3 commits intonodejs:mainfrom
cacharle:add-string-new-from-string-view
Open

Add String::New overload for string_view#1706
cacharle wants to merge 3 commits intonodejs:mainfrom
cacharle:add-string-new-from-string-view

Conversation

@cacharle
Copy link
Copy Markdown
Contributor

Fixes #1703

@cacharle
Copy link
Copy Markdown
Contributor Author

I added the New overload for Symbol aswell. I looked at other functions that take const char* but there is way too many of them and I don't want to unnecessarily bloat the code / break something so let me know if there is other place which could benefit from this overload

@cacharle cacharle marked this pull request as ready for review February 1, 2026 17:11
@legendecas
Copy link
Copy Markdown
Member

Would you mind adding a test case in https://github.com/nodejs/node-addon-api/blob/main/test/name.cc? Thank you!

@legendecas
Copy link
Copy Markdown
Member

I added the New overload for Symbol aswell. I looked at other functions that take const char* but there is way too many of them and I don't want to unnecessarily bloat the code / break something so let me know if there is other place which could benefit from this overload

Sounds good! we can start with these two sites.

@cacharle
Copy link
Copy Markdown
Contributor Author

cacharle commented Feb 3, 2026

Same as #1705, the test take too long to compile, not sure how to run them

@legendecas legendecas moved this from Need Triage to In Progress in Node-API Team Project Feb 13, 2026
@legendecas
Copy link
Copy Markdown
Member

@cacharle I added a doc about building with ninja to speed up local builds: #1709

Copy link
Copy Markdown
Contributor

@KevinEady KevinEady left a comment

Choose a reason for hiding this comment

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

Guards for c++17 can be removed.

@cacharle cacharle force-pushed the add-string-new-from-string-view branch from 1e1d0e2 to 9deb2e2 Compare March 28, 2026 17:48
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 66.66667% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 63.61%. Comparing base (86a0524) to head (9deb2e2).
⚠️ Report is 9 commits behind head on main.

Files with missing lines Patch % Lines
napi-inl.h 66.66% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1706      +/-   ##
==========================================
+ Coverage   63.50%   63.61%   +0.11%     
==========================================
  Files           3        3              
  Lines        2047     2056       +9     
  Branches      728      729       +1     
==========================================
+ Hits         1300     1308       +8     
  Misses        162      162              
- Partials      585      586       +1     

☔ View full report in Codecov by Sentry.
📢 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.

@cacharle
Copy link
Copy Markdown
Contributor Author

Should be good now

Thanks for finishing #1704 for me btw, life got in the way

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.

Add String::New for std::string_view

4 participants