(I am open for other approaches to this, if there are any…)
I want to implement a partial that either receives a simple string or a dict as context. Is there any way to check a variable if it is a dict?
I am aware that I could do the following to check if it’s a string:
{{ if eq (printf "%s" .) . }}
but that won’t be telling me, that it’s a dict if it returns false (could be a float or boolean or even nil or whatever).
Is there any printf-parameter that I can use for a dict (array[ bla=fasel, something=somethingelse])? Or is there a completely different way to either have one single parameter or multiple parameters in a partial?
That’s what I mean, I want to tackle the issue from the other side: I want to know if it’s a dict or not, not if it’s a string or not. Finding out it’s a string is easy, but I want to make sure it’s a data structure that has keynames and values.