Skip to content

Latest commit

 

History

History
19 lines (13 loc) · 522 Bytes

truncate.md

File metadata and controls

19 lines (13 loc) · 522 Bytes

truncate (source code)

  • Curried: false
  • Failsafe status: alternative available

The truncate function truncates a string by adding "..." if it exceeds a specified maximum length.

Arguments:

  • string: The string to be truncated.
  • length: The maximum allowed length of the string.

Usage:

truncate("Hello World", 5); //  "Hello..."
truncate("Hello World", 15); // "Hello World"