Need Something like C# Expression Tree on Javascript -
consider this.
const myfunc = (x) => x.property1; let obj = { property1: "value1", property2: "value2" }; console.log(myfunc(obj)); // output: value1
i need this:
console.log(whatineed(myfunc, obj)) // output: **property1**
is possible achieve requirements ?!
what body of "whatineed" function ?
if run myfunc.tostring()
, give "(x) => x.property1"
. can write parser that, shouldn't hard. hard if want full-feature c#.
Comments
Post a Comment