gistlib
index.tsxfunction trimToMaxLength(str, maxLength) { return str.length <= maxLength ? str : str.slice(0, maxLength); } // Example usage const trimmedString = trimToMaxLength("Hello, World!", 7); console.log(trimmedString); // Output: Hello, 237 chars8 lines
function trimToMaxLength(str, maxLength) { return str.length <= maxLength ? str : str.slice(0, maxLength); } // Example usage const trimmedString = trimToMaxLength("Hello, World!", 7); console.log(trimmedString); // Output: Hello,
gistlibby LogSnag