1.0.4 • Published 1 year ago

better-template-strings v1.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year 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

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago