Skip to content

About

A set of commonly used functions for manipulating and formatting strings.

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

@tsdotnet/text-utility: Text helpers, ready. Format, pad, trim, repeat.

npm version GitHub license

Small text helpers: fill placeholders in a template, pad values to a width, trim, repeat.

Install

npm install @tsdotnet/text-utility

Usage

import { supplant, padLeft } from '@tsdotnet/text-utility';

const name = 'Ada';
supplant('Hello, {name}', { name }); // "Hello, Ada"
padLeft(7, 3); // "007"

Also format, repeat, trim and more; everything is exported by name, or together as textUtility.

Use it from

ESM (import { supplant, padLeft } from '@tsdotnet/text-utility';) or CommonJS (const { supplant, padLeft } = require('@tsdotnet/text-utility');).

In a browser, without a bundler
<script src="https://cdn.jsdelivr.net/npm/@tsdotnet/text-utility@1/dist/umd/text-utility.min.js"></script>
<script>
  const { supplant, padLeft } = tsdotnet.textUtility;
</script>

Docs

tsdotnet.github.io/text-utility

About

A set of commonly used functions for manipulating and formatting strings.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages