Support for Property Accessors
See original GitHub issueHi - do you plan to support property accessors? i.e.:
new LinqRepository(Entity).getOne()
.joinAlso(e => e["someChild"])
I’ve patched ts-simple-nameof locally to get it to work for me, by changing one of the regular expressions:
diff --git a/node_modules/ts-simple-nameof/src/nameof.js b/node_modules/ts-simple-nameof/src/nameof.js
index e084038..7c3e4d9 100644
--- a/node_modules/ts-simple-nameof/src/nameof.js
+++ b/node_modules/ts-simple-nameof/src/nameof.js
@@ -23,7 +23,7 @@ function nameof(nameFunction, options) {
// "function(x){return x.prop}"
// FYI - during local dev testing i observed carriage returns after the curly brackets as well
// Note by maintainer: See https://github.com/IRCraziestTaxi/ts-simple-nameof/pull/13#issuecomment-567171802 for explanation of this regex.
- var matchRegex = /function\s*\(\w+\)\s*\{[\r\n\s]*return\s+\w+\.((\w+\.)*(\w+))/i;
+ var matchRegex = /function\s*\(\w+\)\s*\{[\r\n\s]*return\s+\w+(?:\[\"|\.)((\w+\.)*(\w+))/i;
var es5Match = fnStr.match(matchRegex);
if (es5Match) {
return (options && options.lastProp)
I appreciate such a change may be counter to your goals for the package (or maybe it’s just a bad idea!).
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Property accessors - JavaScript - MDN Web Docs - Mozilla
Property accessors provide access to an object's properties by using the dot notation or the bracket notation. Try it.
Read more >Properties - C# Programming Guide - Microsoft Learn
Properties can be used as if they're public data members, but they're special methods called accessors. This feature enables data to be accessed ......
Read more >PHP RFC: Property Accessors
Implicit accessors, which allow finely controlling property access. They support both read-only and private-write properties. Explicit accessors ...
Read more >AngelScript: Property accessors - AngelCode.com
Property accessors can be used to emulate a single property or an array of properties accessed through the index operator. Property accessors for...
Read more >Cook County Assessor's Office: We are Here to Help
The Assessor's Office Wins National Awards for Transparency and Fairness · Missing Property Tax Exemptions? Homeowners can apply for Certificates of Error.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@Huxpro
Thanks for letting me know about the change. Unfortunately I cannot get the RC to build (probably some of my dependencies are incompatible, and it would take some time to recreate my use case in a fresh project). However https://github.com/facebook/hermes/issues/114#issuecomment-887106990 certainly looks very promising and should fix my issue.
@MikeBKemp
I don’t know anything about
ts-simple-nameof
but if your use case was blocked by https://github.com/facebook/hermes/issues/114, we are adding a special directive"show source"
to maketoString
returning original source code. Would you mind try it with React Native 0.65-rc.3 and see if it helps? You can find more details at https://github.com/facebook/hermes/issues/114#issuecomment-887106990