Skip to content
New issue

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

HW3 accessing arguments of the function #31

Open
levbrie opened this issue Feb 19, 2015 · 0 comments
Open

HW3 accessing arguments of the function #31

levbrie opened this issue Feb 19, 2015 · 0 comments
Labels

Comments

@levbrie
Copy link
Contributor

levbrie commented Feb 19, 2015

@cz2246 asked: How do we access arguments of the function passed as argument. For example in:

var injectedFunc = app.inject(function (Auth, User, MainCtrl, sum) {
return [Auth(), User(), MainCtrl(), sum(1, 2)].join(', ');
});

How can we access the names of the argumnets?

My response:

@cz2246 In this case, the first parameter to inject is a function. All functions have a toString() method that essentially converts the function into its source code version as a string. You then have to parse using a regular expression to get all of the parameters that are passed into that function. Make sense?

@levbrie levbrie added the hw3 label Feb 19, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant