1.1.0 • Published 4 years ago

tag-clean v1.1.0

Weekly downloads
-
License
ISC
Repository
github
Last release
4 years ago

tag-clean

Clears all non-true values from template string

Usage example

  1. Importing

in ts:

import { tls } from 'tag-clean'

in js:

const { tls } = require('tag-clean')
  1. Using
console.log(tls`Something ${someFalseValue && 'Optional Text'}`) // "Something "
console.log(tls`Something ${someTrueValue && 'Optional Text'}`) // "Something Optional Text"
console.log(tls`${null}, ${undefined}, ${false}, ${''}, ${NaN}, ${0}`) // ", , , , , 0"