effect-io-ai

Package: effect
Module: Config

Config.map

Transforms the parsed value of a config with a pure function.

When to use

Use when you need to transform a parsed config value with a function that cannot fail.

Example (Uppercasing a string config)

import { Config, ConfigProvider, Effect } from "effect"

const upper = Config.string("name").pipe(
  Config.map((s) => s.toUpperCase())
)

const provider = ConfigProvider.fromUnknown({ name: "alice" })
// Effect.runSync(upper.parse(provider)) // "ALICE"

See

Signature

declare const map: { <A, B>(f: (a: A) => B): (self: Config<A>) => Config<B>; <A, B>(self: Config<A>, f: (a: A) => B): Config<B>; }

Source

Since v2.0.0