README
tag-clean
Clears all non-true values from template string
Usage example
- Importing
in ts:
import { tls } from 'tag-clean'
in js:
const { tls } = require('tag-clean')
- 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"