String to be truncated
Max length of the string
const str = truncate('Hello World!', 5, { ending: '...' });
console.log(str); // 'hello...'
const str = truncate('Hello World!', 6, { ending: '...', reverse: true });
console.log(str); // '...World!'
Truncates the provided string to fit in the max character length if it truncates it will add the
ending
to the start or end of the string