Socket
Book a DemoInstallSign in
Socket

tag-truthy

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tag-truthy

Tagged template function that filters falsy values

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

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

FAQs

Package last updated on 12 Jul 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts