Hyperlinkv0.8.0-beta.28

SchemaGetter

SchemaGetter.Booleanfunctioneffect/SchemaGetter.ts:732
<E>(): Getter<boolean, E>

Coerces any value to a boolean using the global Boolean() constructor.

When to use

Use when you need a schema getter to coerce a present encoded value to a boolean with Boolean().

Details

The getter is pure, never fails, and delegates to globalThis.Boolean.

Example (Coercing to a boolean)

import { SchemaGetter } from "effect"

const toBool = SchemaGetter.Boolean<string>()
// Getter<boolean, string>
Coercions
export function Boolean<E>(): Getter<boolean, E> {
  return transform(globalThis.Boolean)
}