Version: v0.5.1 - Beta.  We welcome contributors & feedback.  THanks!

String.limit

limit(numCharacters, ending = '...')

Description

If the string length is larger than numCharacters, truncate the string and append ending.

Common punctuation characters will be trimmed from the end before ending is added.

let longString = 'This is a moderately long phrase.';
longString.limit(20);
//= 'This is a moderately...';