(ctx, output, start, base)
| 2612 | } |
| 2613 | |
| 2614 | function isBelowBreakLength(ctx, output, start, base) { |
| 2615 | // Each entry is separated by at least a comma. Thus, we start with a total |
| 2616 | // length of at least `output.length`. In addition, some cases have a |
| 2617 | // whitespace in-between each other that is added to the total as well. |
| 2618 | // TODO(BridgeAR): Add unicode support. Use the readline getStringWidth |
| 2619 | // function. Check the performance overhead and make it an opt-in in case it's |
| 2620 | // significant. |
| 2621 | let totalLength = output.length + start; |
| 2622 | if (totalLength + output.length > ctx.breakLength) |
| 2623 | return false; |
| 2624 | for (let i = 0; i < output.length; i++) { |
| 2625 | if (ctx.colors) { |
| 2626 | totalLength += removeColors(output[i]).length; |
| 2627 | } else { |
| 2628 | totalLength += output[i].length; |
| 2629 | } |
| 2630 | if (totalLength > ctx.breakLength) { |
| 2631 | return false; |
| 2632 | } |
| 2633 | } |
| 2634 | // Do not line up properties on the same line if `base` contains line breaks. |
| 2635 | return base === '' || !StringPrototypeIncludes(base, '\n'); |
| 2636 | } |
| 2637 | |
| 2638 | function reduceToSingleString( |
| 2639 | ctx, output, base, braces, extrasType, recurseTimes, value) { |
no test coverage detected
searching dependent graphs…