Title: Add a normal method to convert PropertyLValue into Value · Issue #1651 · nodejs/node-addon-api · GitHub
Open Graph Title: Add a normal method to convert PropertyLValue into Value · Issue #1651 · nodejs/node-addon-api
X Title: Add a normal method to convert PropertyLValue into Value · Issue #1651 · nodejs/node-addon-api
Description: Currently, a PropertyLValue can only be converted into Value via the type convertion. // cast into var Napi::Value val = obj["key"]; val.ToString(); // explicit cast Napi::Value(obj["key"]).ToString(); It‘s fairly common to directly use ...
Open Graph Description: Currently, a PropertyLValue can only be converted into Value via the type convertion. // cast into var Napi::Value val = obj["key"]; val.ToString(); // explicit cast Napi::Value(obj["key"]).ToStrin...
X Description: Currently, a PropertyLValue can only be converted into Value via the type convertion. // cast into var Napi::Value val = obj["key"]; val.ToString(); // explicit cast Napi::Value(obj["...
Opengraph URL: https://github.com/nodejs/node-addon-api/issues/1651
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Add a normal method to convert PropertyLValue into Value","articleBody":"Currently, a PropertyLValue can only be converted into Value via the type convertion.\n\n```cpp\n// cast into var\nNapi::Value val = obj[\"key\"];\nval.ToString();\n\n// explicit cast\nNapi::Value(obj[\"key\"]).ToString();\n```\n\nIt‘s fairly common to directly use it as a value, but the methods above are quite annoying. The first one needs to name the value, and the second one needs to move the cursor back. Thus I'd suggest adding a helper function behaves like the converter.\n\n\u003e demo usage\n\n```cpp\nobj[\"key\"].value().ToString();\n```\n\n\u003e possible impl\n\n```cpp\nValue value() const { return *this; }\n```\n","author":{"url":"https://github.com/neko-para","@type":"Person","name":"neko-para"},"datePublished":"2025-04-12T13:30:51.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/1651/node-addon-api/issues/1651"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:30b64308-1b81-3731-2bab-326280e2037a |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | AF94:4D83E:7875B5:A46A5A:6A4DB3AF |
| html-safe-nonce | 99b2e6fb7644f886e99ca73fc8c96c9c1a03aa9cda19dfc3f61bb60565c6458b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBRjk0OjREODNFOjc4NzVCNTpBNDZBNUE6NkE0REIzQUYiLCJ2aXNpdG9yX2lkIjoiMjk2Njk0ODA5NDAwNjg5OTYzMSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | e6a841dd7c4c98aa738af6fb5ae4c0c8aa438eb92661a587bee0afb04ad8c3b8 |
| hovercard-subject-tag | issue:2990475754 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/nodejs/node-addon-api/1651/issue_layout |
| twitter:image | https://opengraph.githubassets.com/adff41e3bbc0af9c8cba44734c4744ab4a6ea180c137d95d0808c828aa4e841e/nodejs/node-addon-api/issues/1651 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/adff41e3bbc0af9c8cba44734c4744ab4a6ea180c137d95d0808c828aa4e841e/nodejs/node-addon-api/issues/1651 |
| og:image:alt | Currently, a PropertyLValue can only be converted into Value via the type convertion. // cast into var Napi::Value val = obj["key"]; val.ToString(); // explicit cast Napi::Value(obj["key"]).ToStrin... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | neko-para |
| hostname | github.com |
| expected-hostname | github.com |
| None | 06b8a6144231bf3a234f1c2e9993861e07ce98a905912b114aa386c2d7e84b33 |
| turbo-cache-control | no-preview |
| go-import | github.com/nodejs/node-addon-api git https://github.com/nodejs/node-addon-api.git |
| octolytics-dimension-user_id | 9950313 |
| octolytics-dimension-user_login | nodejs |
| octolytics-dimension-repository_id | 81384578 |
| octolytics-dimension-repository_nwo | nodejs/node-addon-api |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81384578 |
| octolytics-dimension-repository_network_root_nwo | nodejs/node-addon-api |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 32f7b614aca06e6bbd89842b1370df1328264f68 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width