wrap-ansi 1.0.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +8 -1
- package/package.json +1 -1
package/index.js
CHANGED
@@ -92,7 +92,7 @@ function wrapWord(rows, word, cols) {
|
|
92
92
|
// than cols characters.
|
93
93
|
//
|
94
94
|
// 'soft' allows long words to expand past the column length.
|
95
|
-
|
95
|
+
function exec(str, cols, opts) {
|
96
96
|
var options = opts || {};
|
97
97
|
|
98
98
|
var pre = '';
|
@@ -152,4 +152,11 @@ module.exports = function (str, cols, opts) {
|
|
152
152
|
}
|
153
153
|
|
154
154
|
return ret;
|
155
|
+
}
|
156
|
+
|
157
|
+
// for each line break, invoke the method separately.
|
158
|
+
module.exports = function (str, cols, opts) {
|
159
|
+
return String(str).split('\n').map(function (substr) {
|
160
|
+
return exec(substr, cols, opts);
|
161
|
+
}).join('\n');
|
155
162
|
};
|