Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bradgarropy/plop-helper-includes
A plop helper that conditionally renders if an array includes a value.
https://github.com/bradgarropy/plop-helper-includes
array eslint includes jest node plop plop-helper plop-pack prettier typescript
Last synced: about 1 month ago
JSON representation
A plop helper that conditionally renders if an array includes a value.
- Host: GitHub
- URL: https://github.com/bradgarropy/plop-helper-includes
- Owner: bradgarropy
- License: mit
- Created: 2022-09-12T02:36:40.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2022-09-12T02:52:01.000Z (about 2 years ago)
- Last Synced: 2024-10-03T10:02:32.497Z (about 1 month ago)
- Topics: array, eslint, includes, jest, node, plop, plop-helper, plop-pack, prettier, typescript
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/@bradgarropy/plop-helper-includes
- Size: 189 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- Contributing: contributing.md
- License: license
Awesome Lists containing this project
README
# 💧 plop helper includes
[![version][version-badge]][npm]
[![downloads][downloads-badge]][npm]
[![size][size-badge]][bundlephobia]
[![github actions][github-actions-badge]][github-actions]
[![coverage][codecov-badge]][codecov]
[![typescript][typescript-badge]][typescript]
[![contributing][contributing-badge]][contributing]
[![contributors][contributors-badge]][contributors]
[![discord][discord-badge]][discord]_A [`plop`][plop] helper that determines if an array includes a value._
## 📦 Installation
This package is hosted on [npm][npm].
```bash
npm install @bradgarropy/plop-helper-includes
```## 🥑 Usage
First, be sure you have [`plop`][plop] installed. Then, add the following line to your `plopfile.js`.
```javascript
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
```javascript
{
toppings: ["pepperoni", "onions"]
}
```#### helper
```handlebars
{{#includes toppings "pepperoni"}}
pepperoni
{{else}}
no pepperoni
{{/includes}}
{{#includes toppings "onions"}}
onions
{{else}}
no onions
{{/includes}}
```#### output
```text
pepperoni
onions
```## ❔ Questions
🐛 report bugs by filing [issues][issues]
📢 provide feedback with [issues][issues] or on [twitter][twitter]
🙋🏼♂️ use my [ama][ama] or [twitter][twitter] to ask any other questions## ✨ contributors
[codecov]: https://app.codecov.io/gh/bradgarropy/plop-helper-includes
[contributing]: https://github.com/bradgarropy/plop-helper-includes/blob/master/contributing.md
[contributors]: #-contributors
[npm]: https://www.npmjs.com/package/@bradgarropy/plop-helper-includes
[codecov-badge]: https://img.shields.io/codecov/c/github/bradgarropy/plop-helper-includes?style=flat-square
[version-badge]: https://img.shields.io/npm/v/@bradgarropy/plop-helper-includes.svg?style=flat-square
[downloads-badge]: https://img.shields.io/npm/dt/@bradgarropy/plop-helper-includes?style=flat-square
[contributing-badge]: https://img.shields.io/badge/PRs-welcome-success?style=flat-square
[contributors-badge]: https://img.shields.io/github/all-contributors/bradgarropy/plop-helper-includes?style=flat-square
[issues]: https://github.com/bradgarropy/plop-helper-includes/issues
[twitter]: https://twitter.com/bradgarropy
[ama]: https://bradgarropy.com/ama
[bundlephobia]: https://bundlephobia.com/result?p=@bradgarropy/plop-helper-includes
[size-badge]: https://img.shields.io/bundlephobia/minzip/@bradgarropy/plop-helper-includes?style=flat-square
[github-actions]: https://github.com/bradgarropy/plop-helper-includes/actions
[github-actions-badge]: https://img.shields.io/github/workflow/status/bradgarropy/plop-helper-includes/%F0%9F%9A%80%20release?style=flat-square
[typescript]: https://www.typescriptlang.org/dt/search?search=%40bradgarropy%2Fplop-helper-includes
[typescript-badge]: https://img.shields.io/npm/types/@bradgarropy/plop-helper-includes?style=flat-square
[discord]: https://bradgarropy.com/discord
[discord-badge]: https://img.shields.io/discord/748196643140010015?style=flat-square
[plop]: https://plopjs.com
[remix]: https://remix.run