npm stats
  • Search
  • About
  • Repo
  • Sponsor
  • more
    • Search
    • About
    • Repo
    • Sponsor

Made by Antonio Ramirez

tag-truthy

1.0.0

@juliangruber

npmHomeRepoSnykSocket
Downloads:5
$ npm install tag-truthy
DailyWeeklyMonthlyYearly

tag-truthy

Tagged template function that filters falsy values.

Example

const tpl = require('tag-truthy')

const html = tpl`
  <div>
    ${condition && `
      <span>Yay!</span>
    `}
  </div>
`

If condition is truthy, this outputs as expected:

<div>
  <span>Yay!</span>
</div>

If condition is falsy, this cleans up the falsy values and outpus:

<div></div>

Without tag-truthy, the output would be:

<div>
  false
</div>

Installation

$ npm install tag-truthy

license

MIT