tessl install tessl/npm-wrap-ansi@9.0.0Wordwrap a string with ANSI escape codes
Agent Success
Agent success rate when using this tile
100%
Improvement
Agent success rate improvement when using this tile compared to baseline
1.04x
Baseline
Agent success rate without this tile
96%
Build a text wrapping utility that properly handles edge cases involving whitespace-only input strings. The utility should support configurable whitespace preservation behavior.
The utility should wrap text to a specified column width and handle whitespace-only strings correctly based on configuration:
Implement a text wrapping function that:
Support a trim configuration option that controls whitespace handling:
The utility must correctly handle whitespace-only input strings:
" " (three spaces) at width 10 with trim enabled, returns an empty string @test" " (five spaces) at width 10 with trim disabled, returns the spaces wrapped according to column width @test"\t\t" (two tabs) at width 10 with trim enabled, returns an empty string @test" hello " at width 10 with trim enabled, removes leading and trailing spaces but preserves the word @test@generates
/**
* Wraps text to fit within specified column width
*
* @param {string} text - The text to wrap
* @param {number} columns - Maximum column width
* @param {Object} options - Configuration options
* @param {boolean} options.trim - Remove leading/trailing whitespace from wrapped lines (default: true)
* @returns {string} The wrapped text
*/
function wrapText(text, columns, options) {
// Implementation here
}
module.exports = { wrapText };Provides text wrapping support with ANSI escape code handling.
@satisfied-by