# trunc-text

> truncate text by length, doesn't cut words

Latest version **1.0.2** (published 2016-02-01) · MIT license · 0 weekly downloads

## Install

```sh
npm install trunc-text
pnpm add trunc-text
yarn add trunc-text
bun add trunc-text
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2016-02-01 |
| First published | 2016-01-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Nicolás Bevacqua |
| Maintainers | bevacqua |

## Links

- npm: https://www.npmjs.com/package/trunc-text
- Repository: https://github.com/bevacqua/trunc-text
- Issues: https://github.com/bevacqua/trunc-text/issues
- npm.io page: https://npm.io/package/trunc-text

## Recent versions

- 1.0.2 (latest) — 2016-02-01
- 1.0.1 — 2016-01-28
- 1.0.0 — 2016-01-28

## README

# trunc-text

[![Build Status](https://travis-ci.org/bevacqua/trunc-text.svg?branch=master)](https://travis-ci.org/bevacqua/trunc-text)

> truncate text by length, doesn't cut words

# install

using `npm`.

```shell
npm install -S trunc-text
```

# features

- fast
- truncates by complete words, not just by characters

# `trunc(text, limit)`

Returns the result of truncating the provided `text` by `limit`.

## `limit`

Maximum amount of text characters allowed. When the `limit` is reached, the algorithm will trace back to the last word separator and trim the rest into a `…` glyph.

# related

- [`trunc-html`](https://github.com/bevacqua/trunc-html)

# license

MIT

[1]: http://github.com/bevacqua/insane

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