effect-io-ai

Package: effect
Module: Predicate

Predicate.isFunction

Checks whether a value is a function.

When to use

Use when you need a Predicate guard to narrow an unknown value to a callable function.

Details

Uses typeof input === "function".

Example (Guarding functions)

import { Predicate } from "effect"

const data: unknown = () => 1

if (Predicate.isFunction(data)) {
  console.log(data())
}

See

Signature

declare const isFunction: (input: unknown) => input is Function

Source

Since v2.0.0