Skip to content
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

Deprecate groupCollapsed in favor of group and groupEnd #229

Open
adderek opened this issue Nov 25, 2023 · 0 comments
Open

Deprecate groupCollapsed in favor of group and groupEnd #229

adderek opened this issue Nov 25, 2023 · 0 comments

Comments

@adderek
Copy link

adderek commented Nov 25, 2023

What is the issue with the Console Standard?

In my opinion
.groupCollapsed is meaningless
because usually you don't know in advance whether the group should be collapsed or not.

What I propose instead:

  • .group() should be used always
  • The output should decide whether groups should be collapsed or not
    • Since .group() can accept any data, it is difficult to add any additional arguments there :(
    • It is Output to decide whether groups should be folded
    • It is Output to decide whether groups not yet ended should be unfolded
    • It is Output to decide whether groups with errors should remain unfolded
    • It is Output which either supports folding or not
  • When calling .groupEnd() we usually know whether there were any errors and it contains interesting information
    • .groupEnd() could receive additional parameter:
/**
 * @function groupEnd
 * @memberof console
 * @param {string|undefined} [label] Defaults to current group.
 * @param {boolean} [unfold] If true then group should remain unfolded. Default is false.
 */

Though I would prefer to leave this entirely to the Output to decide whether it should be folded or not (preferably fold everything unless there is an error or group is still not ended)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant