truncate

Type:Function
Status:stable
Since:1.0.0
Platform:jsnode
@blackbyte.sugar.shared.string

Truncate a string to a specific length and add an ellipsis at the end

Params

  1. str*-String

    The string to truncate

  2. length*-Number

    The length to truncate to

  3. settings{}Partial<TTruncateSettings>

    Some settings to configure your truncate process

Return

  1. -String

    The truncated string

Example

import truncate from '@blackbyte/sugar/string';
truncate('Hello world', 5); // => Hello...

Settings

  1. ellipsis’…’String

    The ellipsis to add at the end of the truncated string

Todo

  • testsnormal