1.2.4 • Published 6 months ago

@types/html-truncate v1.2.4

Weekly downloads
581
License
MIT
Repository
github
Last release
6 months ago

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

// Type definitions for html-truncate 1.2
// Project: https://github.com/huang47/nodejs-html-truncate
// Definitions by: DefinitelyTyped <https://github.com/DefinitelyTyped>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 3.0

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: Thu, 23 Dec 2021 23:34:49 GMT
  • Dependencies: none
  • Global values: none

Credits

These definitions were written by DefinitelyTyped.

1.2.4

6 months ago

1.2.3

7 months ago

1.2.2

2 years ago

1.2.1

3 years ago

1.2.0

5 years ago