node icon indicating copy to clipboard operation
node copied to clipboard

src: add FromV8Value<T>() for integral and enum types

Open Aditi-1400 opened this issue 9 months ago • 8 comments

From the following comment in the pull request: https://github.com/nodejs/node/pull/57146#discussion_r1963799600

Add a template utility method FromV8Value<T>() to replace the repetitive static_cast<...>(value.As<>()‑>Value()) pattern. It also additionally adds compile‑time range checks for integers.

I've also replaced a bunch of static_casts with the new FromV8Value<T>()

Aditi-1400 avatar Apr 18 '25 18:04 Aditi-1400

Review requested:

  • [ ] @nodejs/crypto
  • [ ] @nodejs/net

nodejs-github-bot avatar Apr 18 '25 18:04 nodejs-github-bot

Codecov Report

Attention: Patch coverage is 88.23529% with 2 lines in your changes missing coverage. Please review.

Project coverage is 90.27%. Comparing base (9cc0195) to head (fabec6a). Report is 480 commits behind head on main.

Files with missing lines Patch % Lines
src/util-inl.h 66.66% 0 Missing and 2 partials :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #57931      +/-   ##
==========================================
- Coverage   90.28%   90.27%   -0.01%     
==========================================
  Files         630      630              
  Lines      186158   186160       +2     
  Branches    36484    36476       -8     
==========================================
- Hits       168067   168057      -10     
+ Misses      10974    10970       -4     
- Partials     7117     7133      +16     
Files with missing lines Coverage Δ
src/crypto/crypto_keys.cc 72.57% <100.00%> (+0.27%) :arrow_up:
src/node_file.cc 76.76% <100.00%> (+0.04%) :arrow_up:
src/node_util.cc 81.73% <100.00%> (-0.06%) :arrow_down:
src/node_v8.cc 80.67% <100.00%> (-0.05%) :arrow_down:
src/node_zlib.cc 78.76% <100.00%> (+0.34%) :arrow_up:
src/process_wrap.cc 66.66% <100.00%> (ø)
src/udp_wrap.cc 78.62% <100.00%> (ø)
src/util-inl.h 80.68% <66.66%> (-0.30%) :arrow_down:

... and 28 files with indirect coverage changes

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

codecov[bot] avatar Apr 18 '25 19:04 codecov[bot]

Failed to start CI
   ⚠  No approving reviews found
   ✘  Refusing to run CI on potentially unsafe PR
https://github.com/nodejs/node/actions/runs/14540925539

github-actions[bot] avatar Apr 18 '25 19:04 github-actions[bot]

This now has a conflict with the main branch, can you rebase?

joyeecheung avatar Apr 23 '25 12:04 joyeecheung

CI: https://ci.nodejs.org/job/node-test-pull-request/66545/

nodejs-github-bot avatar May 02 '25 14:05 nodejs-github-bot

CI: https://ci.nodejs.org/job/node-test-pull-request/66553/

nodejs-github-bot avatar May 03 '25 00:05 nodejs-github-bot

CI: https://ci.nodejs.org/job/node-test-pull-request/66564/

nodejs-github-bot avatar May 03 '25 15:05 nodejs-github-bot

It worked thank you

On Sun, 4 May 2025 at 1:56 am, Node.js GitHub Bot @.***> wrote:

nodejs-github-bot left a comment (nodejs/node#57931) https://github.com/nodejs/node/pull/57931#issuecomment-2848684649

CI: https://ci.nodejs.org/job/node-test-pull-request/66564/

— Reply to this email directly, view it on GitHub https://github.com/nodejs/node/pull/57931#issuecomment-2848684649, or unsubscribe https://github.com/notifications/unsubscribe-auth/BQIUYLZAFWID422ZKHTNSYD24TRJFAVCNFSM6AAAAAB3NQ36XWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDQNBYGY4DINRUHE . You are receiving this because you are subscribed to this thread.Message ID: @.***>

dani2542 avatar May 03 '25 16:05 dani2542

CI: https://ci.nodejs.org/job/node-test-pull-request/66687/

nodejs-github-bot avatar May 07 '25 15:05 nodejs-github-bot

CI: https://ci.nodejs.org/job/node-test-pull-request/66712/

nodejs-github-bot avatar May 08 '25 15:05 nodejs-github-bot

CI: https://ci.nodejs.org/job/node-test-pull-request/66769/

nodejs-github-bot avatar May 12 '25 06:05 nodejs-github-bot

CI: https://ci.nodejs.org/job/node-test-pull-request/67097/

nodejs-github-bot avatar May 26 '25 13:05 nodejs-github-bot

CI: https://ci.nodejs.org/job/node-test-pull-request/67119/

nodejs-github-bot avatar May 26 '25 20:05 nodejs-github-bot

CI: https://ci.nodejs.org/job/node-test-pull-request/67143/

nodejs-github-bot avatar May 27 '25 11:05 nodejs-github-bot

Landed in faada65d16c754b047a5ddee524f4b989756b72b

nodejs-github-bot avatar Jun 24 '25 04:06 nodejs-github-bot