@robert.tools/eleventy-filter-safe-param
v1.0.1
Published
Eleventy-Filter to make sure to always have a result
Downloads
362
Maintainers
Readme
🗂️ @robert.tools/eleventy-filter-safe-param
Helper to safely return a value or a fallback or an alternative value.
📜 Usage
🟢 Installation
npm install @robert.tools/eleventy-filter-safe-param📝 Sample usage
import safeParam from '@robert.tools/eleventy-filter-safe-param';
safeParam('hello'); // 'safeParam: hello'📜 Usage
{{ value | safeParam() }} {# value or empty string #}
{{ value | safeParam(fallback) }} {# value or fallback #}
{{ value | safeParam(fallback, alternative) }} {# value or fallback or alternative #}⚖️ Notes
This software is hand-crafted, test-driven and assisted by AI tools. I know each line of my code. ✌️
| Tool | Comment | | ------------- | ------------- | | | Test-driven development with Jest | | | Part of the robert.tools ecosystem | | | Code completion | | | chatGPT research |
