effect-tree - v1.0.36
    Preparing search index...

    Function modFormatter

    • Function

      Modify the formatter function of a tree theme using the given function.

      Parameters

      • f: EndoOf<EndoOf<string>>

        Will be given the formatter function and expected to return an updated value.

      Returns EndoOf<Draw.Theme>

      import {Draw, from, of} from 'effect-tree'
      import {pipe, flow} from 'effect'

      const theme: Draw.Theme = pipe(
      Draw.getTheme('thin'),
      Draw.modFormatter(f => flow(f, label => ${label}»`)),
      )

      const tree = from('a', of('b'), of('c'))

      expect(Draw.themedTree(tree, theme)).toEqual([
      '┬«a» ',
      '├─«b»',
      '└─«c»',
      ])