@robert.tools/eleventy-filter-safe-param-if
v1.0.0
Published
Helper to safely return a value or a fallback or an alternative value if a condition is true.
Maintainers
Readme
🗂️ @robert.tools/eleventy-filter-safe-param-if
Helper to safely return a value or a fallback or an alternative value if a condition is true.
📜 Usage
🟢 Installation
npm install @robert.tools/eleventy-filter-safe-param-if📝 Sample usage
import safeParamIf from '@robert.tools/eleventy-filter-safe-param-if';
📜 Usage
{{ value | safeParamIf(condition) }} {# value or empty string #}
{{ value | safeParamIf(condition,fallback) }} {# value or fallback #}
{{ value | safeParamIf(condition,fallback, alternative) }} {# value or fallback or alternative #}🗃️ commands
After an npm install with npm i the following commands are available:
- initialize placeholders:
npm run init <semantic> - release a new version:
npm run release <semantic>
⚖️ 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 |
