Hyperlinkv0.8.0-beta.28

Predicate

Predicate.isNullishfunctioneffect/Predicate.ts:893
<A>(input: A): input is A & (null | undefined)

Checks whether a value is null or undefined.

When to use

Use when you need a Predicate guard for nullish values.

Details

Uses input === null || input === undefined.

Example (Guarding nullish values)

import { Predicate } from "effect"

const values = [0, null, "", undefined]
const nullish = values.filter(Predicate.isNullish)

console.log(nullish)
export function isNullish<A>(input: A): input is A & (null | undefined) {
  return input === null || input === undefined
}