bradgarropy / plop-helper-includes

A plop helper that conditionally renders if an array includes a value.

Home Page:https://www.npmjs.com/package/@bradgarropy/plop-helper-includes

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

πŸ’§ plop helper includes

version downloads size github actions coverage typescript contributing contributors discord

A plop helper that determines if an array includes a value.

πŸ“¦ Installation

This package is hosted on npm.

npm install @bradgarropy/plop-helper-includes

πŸ₯‘ Usage

First, be sure you have plop installed. Then, add the following line to your plopfile.js.

plop.load("@bradgarropy/plop-helper-includes")

Once loaded, you now have access the following helpers.

includes

Conditional template based on if an array includes a string.

input

{
    toppings: ["pepperoni", "onions"]
}

helper

{{#includes toppings "pepperoni"}}
    pepperoni
{{else}}
    no pepperoni
{{/includes}}
{{#includes toppings "onions"}}
    onions
{{else}}
    no onions
{{/includes}}

output

pepperoni
onions

❔ Questions

πŸ› report bugs by filing issues
πŸ“’ provide feedback with issues or on twitter
πŸ™‹πŸΌβ€β™‚οΈ use my ama or twitter to ask any other questions

✨ contributors


Brad Garropy

πŸ’» πŸ“– ⚠️ πŸš‡

About

A plop helper that conditionally renders if an array includes a value.

https://www.npmjs.com/package/@bradgarropy/plop-helper-includes

License:MIT License


Languages

Language:JavaScript 67.8%Language:TypeScript 22.6%Language:Handlebars 9.6%