Hyperlinkv0.8.0-beta.28

Boolean

Boolean.Booleanconsteffect/Boolean.ts:50
<T>(value?: T): boolean

Exposes the global boolean constructor for JavaScript truthiness coercion.

When to use

Use to access native JavaScript truthiness coercion from the Effect module namespace.

Gotchas

This follows native truthiness rules. For example, non-empty strings such as "false" coerce to true.

Example (Coercing values to booleans)

import { Boolean } from "effect"

const bool = Boolean.Boolean(1)
console.log(bool) // true

const fromString = Boolean.Boolean("false")
console.log(fromString) // true (non-empty string)

const fromZero = Boolean.Boolean(0)
console.log(fromZero) // false
constructors
Source effect/Boolean.ts:501 lines
export const Boolean = globalThis.Boolean