1.0.4 • Published 3 years ago

better-template-strings v1.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

better-template-strings

A lightweight template string util to make working with dynamic and nullish data a breeze.

Usage

Tired of seeing undefined in unguarded strings?

// Hello undefined!
`Hello ${data?.maybeNullish}!`;
// We have to guard for every argument
data?.maybeNullish ? `Hello ${data?.maybeNullish}!` : '';

The simple solution

import { f } from 'better-template-strings';

// Returns "" if any argument is nullish
f`Hello ${data?.maybeNullish}!`;

// Returns "Some Error Occured"
f('Some Error Occured')`Hello ${data?.maybeNullish}!`;
1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago