handlebars-rust
handlebars-rust copied to clipboard
extracting unused parameters?
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,
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
.