Skip to content

Deprecate groupCollapsed in favor of group and groupEnd #229

Open
@adderek

Description

@adderek

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions