-
-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New option to define indentation #13
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like it would need to handle a lot of edge cases if it's an open-ended "indent" string.
I'd think probably the best way to do this is allowing indent
to be an integer > 0
, or the string '\t'
, and treat that as N spaces, or "tabs".
I'm not convinced this is a feature worth adding, but it's totally fine to explore what it would look like in this PR.
I'm also not a 100% sure this is a needed feature, but I found myself missing it. I figured I'll put in a bit of extra effort to open up a PR after I implemented it, just to see if this is needed or not. I'm not familiar with all the use cases of this module, so I'll gracefully accept if you think this is not something you want to include. |
9ea8930
to
158899a
Compare
@mkls thank you for this! Please merge! :D |
95d2316
to
3ddb3e4
Compare
3539b0e
to
66158f9
Compare
e4472d3
to
42f214b
Compare
Codecov Report
@@ Coverage Diff @@
## master #13 +/- ##
==========================================
+ Coverage 97.71% 98.02% +0.30%
==========================================
Files 2 2
Lines 219 253 +34
Branches 84 98 +14
==========================================
+ Hits 214 248 +34
Misses 5 5
Continue to review full report at Codecov.
|
0762b40
to
900d3d8
Compare
- [New] add `indent` option (#13) - [New] add `customInspect` option, to disable custom inspect methods - [New] add `maxStringLength` option - [Fix] do not be fooled by a function’s own `toString` method - [Fix] when truncating a deep array, note it as `[Array]` instead of just `[Object]` - [patch] indicate explicitly that anon functions are anonymous, to match node - [readme] fix repo URLs, remove testling - [meta] add `safe-publish-latest` - [Tests] add Date and RegExp tests - [Tests] add codecov - [actions] add automatic rebasing / merge commit blocking - [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `core-js`, `tape`; add `aud`; loosen the `core-js` dep
I had a use case where I wanted to see the output of object-inspect indented,
Current output for
inspect({a: 1, b: 2})
:New option would make this possible:
inspect({a: 1, b: 2}, {indent: ' '})
:Added a few test cases that show other cases about how it would work.
If you guys think this would be something useful to include then I'm happy to work on it a bit more and clean it up if needed. Opened this PR is just to test the idea and get some feedback.
Fixes #27.