# @openinf/util-text

> Essential cross-platform terminal-friendly text utilities

Latest version **1.1.2** (published 2021-02-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install @openinf/util-text
pnpm add @openinf/util-text
yarn add @openinf/util-text
bun add @openinf/util-text
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.2 |
| Published | 2021-02-07 |
| First published | 2021-01-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 25.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | The OpenINF Authors |
| Maintainers | dereknongeneric |

## Links

- npm: https://www.npmjs.com/package/@openinf/util-text
- Repository: https://github.com/openinf/util-text
- Homepage: https://github.com/openinf/util-text#readme
- Issues: https://github.com/openinf/util-text/issues
- npm.io page: https://npm.io/package/@openinf/util-text

## Dependencies (3)

- [cli-color](https://npm.io/package/cli-color.md) ^2.0.0
- [has-unicode](https://npm.io/package/has-unicode.md) ^2.0.1
- [supports-ansi](https://npm.io/package/supports-ansi.md) ^1.0.6

## Recent versions

- 1.1.2 (latest) — 2021-02-07
- 1.1.1 — 2021-02-05
- 1.0.1 — 2021-01-31
- 1.0.0 — 2021-01-28

## README

<h1 align="center">@openinf/util-text</h1>

<p align="center">Essential cross-platform terminal-friendly text utilities</p>

<br />

<p align="center">
  <a href="https://www.npmjs.com/package/@openinf/util-text"><img src="https://img.shields.io/npm/v/@openinf/util-text?style=plastic" alt="view on npm" /></a>
  <img src="https://img.shields.io/github/languages/top/openinf/util-text?color=blue&style=plastic" />
  <a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/github/license/openinf/util-text?color=blue&style=plastic" alt="License: MIT" /></a>
</p>

<br />

_The high-level goal of `@openinf/util-text` is to serve as a Node.js package
containing **essential cross-platform text utilities** that degrade gracefully
when used in terminals lacking feature support. As is the case with any software
project in continuous development, omissions and errors may exist, for which
contributions are welcome._

<br />

---

<br />

## Installation

`@openinf/util-text` runs on Node.js and is available via `npm`.

```shell
npm install @openinf/util-text
```

## Usage

To get started using the text utils provided by `@openinf/util-text`, all
that needs to be done is either import/require (depending on the module format)
the default export of the module or destructure the individual named helper
functions exported.

```ts
import { blueify, ellipsify } from '@openinf/util-text';

console.log(blueify(ellipsify('Deserializing database tables')));
```

<br />

---

<br />

## Functions

<dl>
<dt><a href="#blueify">blueify(text)</a> ⇒ <code>string</code></dt>
<dd><p>Returns the supplied string as blue colored if ANSI escapes are supported.</p>
</dd>
<dt><a href="#curlyQuote">curlyQuote(text)</a> ⇒ <code>string</code></dt>
<dd><p>Returns the supplied string as curly quoted if Unicode is supported.</p>
</dd>
<dt><a href="#ellipsify">ellipsify(text)</a> ⇒ <code>string</code></dt>
<dd><p>Returns the supplied string as ellipsified if Unicode is supported.</p>
</dd>
<dt><a href="#italicize">italicize(text)</a> ⇒ <code>string</code></dt>
<dd><p>Returns the supplied string as italicized if ANSI escapes are supported.</p>
</dd>
<dt><a href="#mdCodeSpans2html">mdCodeSpans2html(text)</a> ⇒ <code>string</code></dt>
<dd><p>Processes the supplied string by transforming any Markdown backtick code
spans (begining and ending with a single backtack) into HTML code elements.</p>
</dd>
<dt><a href="#redden">redden(text)</a> ⇒ <code>string</code></dt>
<dd><p>Returns the supplied string as red colored if ANSI escapes are supported.</p>
</dd>
<dt><a href="#underline">underline(text)</a> ⇒ <code>string</code></dt>
<dd><p>Returns the supplied string as underlined if ANSI escapes are supported.</p>
</dd>
<dt><a href="#yellow">yellow(text)</a> ⇒ <code>string</code></dt>
<dd><p>Returns the supplied string as yellow colored if ANSI escapes are supported.</p>
</dd>
</dl>

<a name="UnicodeEscapes"></a>

## UnicodeEscapes : <code>enum</code>
**Kind**: global enum  
**Properties**

| Name | Type | Default |
| --- | --- | --- |
| infoSymbol | <code>string</code> | <code>&quot;ⓘ&quot;</code> | 
| midlineEllipsis | <code>string</code> | <code>&quot;⋯&quot;</code> | 
| ellipsis | <code>string</code> | <code>&quot;…&quot;</code> | 
| errorSymbol | <code>string</code> | <code>&quot;ⓧ&quot;</code> | 
| leftDoubleQuotes | <code>string</code> | <code>&quot;“&quot;</code> | 
| rightDoubleQuotes | <code>string</code> | <code>&quot;”&quot;</code> | 
| warningSymbol | <code>string</code> | <code>&quot;⚠&quot;</code> | 

<a name="blueify"></a>

## blueify(text) ⇒ <code>string</code>
Returns the supplied string as blue colored if ANSI escapes are supported.

**Kind**: global function  

| Param | Type |
| --- | --- |
| text | <code>string</code> | 

<a name="curlyQuote"></a>

## curlyQuote(text) ⇒ <code>string</code>
Returns the supplied string as curly quoted if Unicode is supported.

**Kind**: global function  

| Param | Type |
| --- | --- |
| text | <code>string</code> | 

<a name="ellipsify"></a>

## ellipsify(text) ⇒ <code>string</code>
Returns the supplied string as ellipsified if Unicode is supported.

**Kind**: global function  

| Param | Type |
| --- | --- |
| text | <code>string</code> | 

<a name="italicize"></a>

## italicize(text) ⇒ <code>string</code>
Returns the supplied string as italicized if ANSI escapes are supported.

**Kind**: global function  

| Param | Type |
| --- | --- |
| text | <code>string</code> | 

<a name="mdCodeSpans2html"></a>

## mdCodeSpans2html(text) ⇒ <code>string</code>
Processes the supplied string by transforming any Markdown backtick code
spans (begining and ending with a single backtack) into HTML code elements.

**Kind**: global function  

| Param | Type |
| --- | --- |
| text | <code>string</code> | 

<a name="redden"></a>

## redden(text) ⇒ <code>string</code>
Returns the supplied string as red colored if ANSI escapes are supported.

**Kind**: global function  

| Param | Type |
| --- | --- |
| text | <code>string</code> | 

<a name="underline"></a>

## underline(text) ⇒ <code>string</code>
Returns the supplied string as underlined if ANSI escapes are supported.

**Kind**: global function  

| Param | Type |
| --- | --- |
| text | <code>string</code> | 

<a name="yellow"></a>

## yellow(text) ⇒ <code>string</code>
Returns the supplied string as yellow colored if ANSI escapes are supported.

**Kind**: global function  

| Param | Type |
| --- | --- |
| text | <code>string</code> | 


<br />

---

<br />

<p align="center">&copy; The OpenINF Authors</center></p>
<p align="center"><img height="32px" width="32px" src="https://raw.githubusercontent.com/openinf/openinf.github.io/live/logo.svg" /></p>

---
_Source: https://npm.io/package/@openinf/util-text · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
