# text-trunc

> Long text shortener

Latest version **0.0.8** (published 2025-10-10) · ISC license · 0 weekly downloads

## Install

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

## Health

**Score 45/100 (D)** — status: stable.

Positive: no vulnerabilities.

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

## Facts

| | |
|---|---|
| Version | 0.0.8 |
| Published | 2025-10-10 |
| First published | 2025-10-10 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 2.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Ahmad Heysami |
| Maintainers | heysami |
| Keywords | text-truncate, text, paragraph, txt |

## Links

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

## Alternatives

- [@mce/gif](https://npm.io/package/@mce/gif.md) — 2.6K weekly downloads
- [cleanse](https://npm.io/package/cleanse.md) — 173 weekly downloads
- [str](https://npm.io/package/str.md) — 127 weekly downloads
- [naming](https://npm.io/package/naming.md) — 95 weekly downloads
- [tap-telco-api](https://npm.io/package/tap-telco-api.md) — 19 weekly downloads

## Recent versions

- 0.0.8 (latest) — 2025-10-10

## README

# Long text shortener

## Installation

Use the following commands to install

```bash
# NPM
npm i txt-trunc
# YARN
yarn add txt-trunc
```

## Usage

```javascript
const textTrunc = require("text-trunc");
// OR
import textTrunc from "text-trunc";

const text = "your text";
// arguments [text, length, options?]
let truncate = textTrunc(text, 5, {});
```

# Parameter

#### text: The text to be shortened

#### length: The number of words that are shortened and its default value is 10

#### options: ⬇⬇⬇⬇⬇⬇⬇

# Options

#### options.start

The default value of this option is equal to 0 and it determines that the text to be shortened starts from the second character.

#### options.dots

This option determines what character or characters should be placed at the end of the shortened text
The default value of this option is equal to "..." which can be set as desired

#### options.seperator

In this option, any value you put will be placed instead of the space between the words

## License

[MIT](https://choosealicense.com/licenses/mit/)

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