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

    Function mapThemes

    • Map over all themes to build a record theme namef(theme).

      Type Parameters

      • A

      Parameters

      • f: (
            theme: Draw.Theme,
            name:
                | "ascii"
                | "double"
                | "hDouble"
                | "hThick"
                | "round"
                | "space"
                | "thick"
                | "thin"
                | "vDouble"
                | "vThick"
                | "dashed"
                | "dashedWide"
                | "dotted"
                | "thickDashed"
                | "thickDashedWide"
                | "thickDotted"
                | "bullets"
                | "hThickDashed"
                | "hThickDashedWide"
                | "hThickDotted"
                | "unix"
                | "unixRound"
                | "vThickDashed"
                | "vThickDashedWide"
                | "vThickDotted",
        ) => A

      Returns Record<ThemeName, A>

      import {Draw} from 'effect-tree'
      import {Array, pipe, Record} from 'effect'

      // Place all elbows from all themes in a record with theme name
      // as key.
      const actual: Record<Draw.ThemeName, string> = Draw.mapThemes(
      Draw.getGlyph.flipped('elbow')
      )

      const expected = pipe(
      Draw.themeNames,
      Array.map(themeName => [
      themeName,
      Draw.getTheme(themeName).glyphs.elbow,
      ] as const),
      Record.fromEntries
      )

      expect(actual).toEqual(expected)