# @types/html-truncate

> TypeScript definitions for html-truncate

Latest version **1.2.4** (published 2023-11-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install @types/html-truncate
pnpm add @types/html-truncate
yarn add @types/html-truncate
bun add @types/html-truncate
```

## Health

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

Positive: has types; no vulnerabilities; high maintenance score; popular repo; extremely popular.

Warnings: low downloads; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 1.2.4 |
| Published | 2023-11-07 |
| First published | 2019-03-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 3.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 51430 |
| Maintainers | types |

## Links

- npm: https://www.npmjs.com/package/@types/html-truncate
- Repository: https://github.com/DefinitelyTyped/DefinitelyTyped
- Homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/html-truncate
- npm.io page: https://npm.io/package/@types/html-truncate

## Recent versions

- 1.2.4 (latest) — 2023-11-07
- 1.2.2 (ts3.8) — 2021-12-23
- 1.2.1 (ts3.6) — 2021-07-20
- 1.2.0 (ts3.0) — 2019-03-07
- 1.2.3 — 2023-10-18

## README

# Installation
> `npm install --save @types/html-truncate`

# Summary
This package contains type definitions for html-truncate (https://github.com/huang47/nodejs-html-truncate).

# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/html-truncate.
## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/html-truncate/index.d.ts)
````ts
interface TruncateOptions {
    /**
     * Flag to specify if keep image tag, false by default.
     */
    keepImageTag?: boolean;
    /**
     * Omission symbol for truncated string, '...' by default.
     */
    ellipsis?: boolean | string;

    /**
     * truncates last word, true by default
     */
    truncateLastWord?: boolean;

    /**
     * Tolerance when options.truncateLastWord is false before we give up and just truncate at the maxLength position, 10 by default (but not greater than maxLength)
     */
    slop?: number;
}

/**
 * Truncate HTML text and also keep tag safe.
 */
declare function truncate(input: string, maxLength: number, options?: TruncateOptions): string;

export = truncate;

````

### Additional Details
 * Last updated: Tue, 07 Nov 2023 03:09:37 GMT
 * Dependencies: none

# Credits
These definitions were written by .

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