You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[New] add breakLength option for single-line output
When breakLength is set to Infinity, output will always be single-line regardless of the indent option.
This matches the behavior of Node.js `util.inspect({ breakLength: Infinity })`.
Fixes#47
- Add validation for breakLength option (positive integer or Infinity)
- When breakLength is Infinity, skip indentation to force single-line output
- Add tests for validation and functionality
- Update README documentation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: readme.markdown
+6Lines changed: 6 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -54,6 +54,12 @@ Additional options:
54
54
-`customInspect`: When `true`, a custom inspect method function will be invoked (either undere the `util.inspect.custom` symbol, or the `inspect` property). When the string `'symbol'`, only the symbol method will be invoked. Default `true`.
55
55
-`indent`: must be "\t", `null`, or a positive integer. Default `null`.
56
56
-`numericSeparator`: must be a boolean, if present. Default `false`. If `true`, all numbers will be printed with numeric separators (eg, `1234.5678` will be printed as `'1_234.567_8'`)
57
+
-`breakLength`: must be a non-negative integer or `Infinity`, if present. Controls single-line vs multi-line output when used with `indent`. Similar to `util.inspect`'s `breakLength` option.
58
+
-`Infinity`: forces single-line output regardless of length
59
+
-`0`: forces multi-line output
60
+
- Finite positive integer: keeps output single-line if length does not exceed this value, otherwise breaks into multiple lines
61
+
- Default (not specified): preserves original behavior. Objects always use multi-line with `indent`, arrays and collections stay single-line unless an element contains newlines
62
+
-**Note**: When `breakLength` is specified, objects will also stay single-line if they fit within the threshold (unlike the default behavior where objects always go multi-line with `indent`)
0 commit comments