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

extracting unused parameters? #565

Open
mojindri opened this issue Feb 9, 2023 · 1 comment
Open

extracting unused parameters? #565

mojindri opened this issue Feb 9, 2023 · 1 comment
Labels

Comments

@mojindri
Copy link

mojindri commented Feb 9, 2023

Hi,
Let's say we have built a couple of partials with these names "Car" and "Airplane", which are also connected to JSON objects of the same names. Each of these objects has a field named "Name", and in the partials, this field is used to print the "Name" value. However, the developer made a mistake and in the "Car" partial, he forgot to write

{{Name}}

. Normally, this is not an error from the Handlebars engine's perspective, but as a programmer, I would like to provide functionality so that if the "{{Name}}" field is not defined, the system will fail.
do you have maybe suggestions? is there any workaround maybe? lets say, is it possible get a list of parameters from handlebars engine where "{{}}" statements are used in "Car" partial?
regards,

@sunng87
Copy link
Owner

sunng87 commented Feb 15, 2023

We might be able to do it with a helper, that logs or just counts its references. For example, write {{tracked Name}} in your template, given tracked is a helper that increases a counter and return the value of Name.

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

2 participants