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.
Files changed (2) hide show
  1. package/index.js +8 -1
  2. 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
- module.exports = function (str, cols, opts) {
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
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wrap-ansi",
3
- "version": "1.0.0",
3
+ "version": "2.0.0",
4
4
  "description": "Wordwrap a string with ANSI escape codes",
5
5
  "license": "MIT",
6
6
  "repository": "chalk/wrap-ansi",