Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Item

A helper class that can be used to pretty print items of Loxes

Hierarchy

  • Item

Methods

Methods

prettify

  • prettify(colored?: boolean, box?: object): string
  • prettifies the output of a Lox' item - similar to what the console methods do, but with some improvements:

    • the depth of objects / arrays is not bound to 3
    • the indent is configurable
    • indent is shown with vertical indicator lines
    • objects can be filtered to specific keys (helpful when dealing with large items)
    Example
    Item.of(outputLox).prettify(true, {
      depth: outputLox.module.slicedName.length + outputLox.box.length,
      color: outputLox.module.color,
    })
    

    Parameters

    • colored: boolean = true

      should the output be colored (with ANSI colors)

    • Optional box: object

      options for the box surrounding the printed item

      • Optional depth?: number

        the vertical depth, where the box starts / ends (typically the column of the log's box)

        • if left undefined, the box will be grey
      • Optional color?: string

        color of the box and surrounding text (typically the color of the log's box)

        • if left undefined the box will have a depth of 20 and is not connected to the surrounding box layout

    Returns string

    a pretty string of the item

Static of

  • of(lox: Lox): Item
  • The static constructor of the Item helper class. Use it for any OutputLox or ErrorLox:

    Item.of(outputLox)
    

    Parameters

    • lox: Lox

      to pretty print the item for

    Returns Item

    a chained function prettify(...) to pretty print the item of the lox

Generated using TypeDoc