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
Add maxDepth
option
#18
Conversation
This comment has been minimized.
This comment has been minimized.
Can you add some proper API docs in the readme for the option? Example of how I tend to do it: https://github.com/sindresorhus/boxen#api |
I've added an API section to the README 👍 |
Trying to move the ball forward on this one, are the new API docs sufficient? :) |
@@ -7,6 +7,10 @@ declare namespace serializeError { | |||
message?: string; | |||
code?: string; | |||
} & JsonObject; | |||
|
|||
type Options = { | |||
maxDepth: number; |
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.
Needs a doc comment with a code example. See how to do that here: https://github.com/sindresorhus/typescript-definition-style-guide#documentation
// Passing `maxDepth` will limit how deep we will copy the error object | ||
const nestedError = {...error, a: {b: 'c'}}; | ||
console.log(serializeError(nestedError), {maxDepth: 1}); | ||
//=> {name: 'Error', message: 'oops', stack: stack: 'Error: 🦄\n at Object.<anonymous> …', a: {} } |
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.
I think this example should be placed in the docs for the option.
Type: `number`<br> | ||
Default: `Infinity` | ||
|
||
Specify a maximum depth on the serialized error object. |
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.
Is it clear enough what "maximum depth" refers to? Maybe mention "properties".
I would also include some use-cases of when this option could be useful.
maxDepth
option
All's fine, but would be awesome to know what properies are hidden/deleted by maxDepth logic. |
At the moment simpliest way is to use
|
@gillesdemey Bump |
Closing for lack of response. |
fixes #16