| 8104 | } |
| 8105 | |
| 8106 | function reduceToSingleString(output, base, braces) { |
| 8107 | var numLinesEst = 0; |
| 8108 | var length = output.reduce(function (prev, cur) { |
| 8109 | numLinesEst++; |
| 8110 | if (cur.indexOf('\n') >= 0) numLinesEst++; |
| 8111 | return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1; |
| 8112 | }, 0); |
| 8113 | |
| 8114 | if (length > 60) { |
| 8115 | return braces[0] + (base === '' ? '' : base + '\n ') + ' ' + output.join(',\n ') + ' ' + braces[1]; |
| 8116 | } |
| 8117 | |
| 8118 | return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1]; |
| 8119 | } // NOTE: These type checking functions intentionally don't use `instanceof` |
| 8120 | // because it is fragile and can be easily faked with `Object.create()`. |
| 8121 | |
| 8122 | |