spook
spook copied to clipboard
Add template method: (is_)on
Description
Adds a template function: is_on. Available as test: on.
Motivation and Context
This allows for a cleaner syntax in templates. For example:
{{ is_on("light.kitchen") }}
{{ "light.kitchen" | is_on }}
The real gem here is the test usage:
{% if "light.kitchen" is on %}
Yes the light is on!
{% endif %}
How has this been tested?
Screenshots (if appropriate):
Types of changes
- [ ] Bug fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] Other
Checklist
- [x] My code follows the code style of this project.
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
Quality Gate passed
Kudos, no new issues were introduced!
0 New issues
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code