truncate (source code)
- Curried: false
- Failsafe status: alternative available
The truncate
function truncates a string by adding "..." if it exceeds a
specified maximum length.
string
: The string to be truncated.length
: The maximum allowed length of the string.
truncate("Hello World", 5); // "Hello..."
truncate("Hello World", 15); // "Hello World"