Skip to content

safeStringify & %c support #121

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

Merged
merged 17 commits into from
Apr 8, 2025
Merged

safeStringify & %c support #121

merged 17 commits into from
Apr 8, 2025

Conversation

Dobrunia
Copy link
Contributor

@Dobrunia Dobrunia commented Apr 3, 2025


return {
message: args
.map((arg) => (typeof arg === 'string' ? arg : safeStringify(arg)))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what if arg is number, boolean?

/**
* Safely stringifies objects handling circular references
*/
const safeStringify = (obj: unknown): string => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest using safe-stringify since it is almost the same, but covered by tests

@neSpecc
Copy link
Member

neSpecc commented Apr 8, 2025

All ESLint issues should be fixed

*
* @param arg - Console arguments
*/
const stringifyArg = (arg: unknown): string => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use named function instead of anonymous

@Dobrunia Dobrunia merged commit d6c1221 into master Apr 8, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants