We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Running the code:
let testMethod = (a,b)=>{return a+b;}; console.log(testMethod.toString());
Results in the output:
"function testMethod() { [native code] }"
Same code run in chrome devtools outputs:
"(a,b)=>{return a+b;}"
It would be very nice if the arguments a and b were present, so it would be possible to detect arguments of a function programatically.
a
b
Or is this somehow possible in another way in jint?
The text was updated successfully, but these errors were encountered:
I found a way to work around it, by exposing a c# method to js, and using reflection to find the parameters:
engine.SetValue("getFunctionArguments", new Func<Delegate, string[]>((function)=>{ List<string> foundParameters = new List<string>(); foreach(var info in function.Target.GetType().GetProperties()) { if(info.Name == "FunctionDeclaration") { Esprima.Ast.IFunction functionDeclaration = (Esprima.Ast.IFunction) info.GetValue(function.Target); foreach(var param in functionDeclaration.Params.ToArray()) { foundParameters.Add(param.ToString()); } } } return foundParameters.ToArray(); }));
Calling getFunctionArguments from JS, with the function i need arguments for, returns my wanted array of argument names.
getFunctionArguments
Sorry, something went wrong.
No branches or pull requests
Running the code:
Results in the output:
"function testMethod() { [native code] }"
Same code run in chrome devtools outputs:
"(a,b)=>{return a+b;}"
It would be very nice if the arguments
a
andb
were present, so it would be possible to detect arguments of a function programatically.Or is this somehow possible in another way in jint?
The text was updated successfully, but these errors were encountered: