@types/html-truncate
TypeScript icon, indicating that this package has built-in type declarations

1.2.4 • Public • Published

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

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 .

Readme

Keywords

none

Package Sidebar

Install

npm i @types/html-truncate

Weekly Downloads

21,934

Version

1.2.4

License

MIT

Unpacked Size

3.8 kB

Total Files

5

Last publish

Collaborators

  • types