go-sprout / sprout

From sprig to sprout - Useful template functions for Go templates with steroids
https://sprout.atom.codes
MIT License
86 stars 4 forks source link

feat: add `hasField` method for use with structs #61

Closed mbezhanov closed 3 weeks ago

mbezhanov commented 3 weeks ago

Description

Closes #60

Changes

The PR introduces a hasField method to the reflect registry, to address the use case explained in #60.

Checklist

42atomys commented 3 weeks ago

Hello @mbezhanov,

Thank you for your first contribution to Sprout! 🌱 💜

I’ve made a few changes:

For example:

{{ .struct | hasField "boo" }}

Your proposals have been accepted and will be merged soon. You can start using them with the main branch; the functions will be included in the next release 🎉